[mousetrap/gnome3-wip: 162/240] Customize the `install` and `egg_info` commands
- From: Heidi Ellis <heidiellis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mousetrap/gnome3-wip: 162/240] Customize the `install` and `egg_info` commands
- Date: Mon, 8 Sep 2014 15:26:11 +0000 (UTC)
commit cc02f109578726a6b25a36337e719b51d4cd7356
Author: Kevin Brown <kevin kevinbrown in>
Date: Tue Jun 24 22:58:40 2014 -0400
Customize the `install` and `egg_info` commands
During `egg_info`, specific dependencies which must be installed
to the system will be checked. If they are not found, an error
will be written which explains the problem and how it can be fixed
on yum- and apt-based systems.
During `install`, the translations will be compiled so MouseTrap
will be able to detect and use them.
setup.py | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
---
diff --git a/setup.py b/setup.py
index 5557def..835ed22 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,6 @@
from setuptools import setup, find_packages
+from setuptools.command.egg_info import egg_info
+from setuptools.command.install import install
import os
import sys
@@ -29,6 +31,78 @@ if PYTHON_VERSION[0] > 2:
else:
requirements = python2_requirements
+
+class EggInfoCommand(egg_info):
+
+ def run(self):
+ try:
+ import gi.repository
+ except ImportError:
+ sys.stderr.write(
+"""
+PyGObject does not appear to be installed. This cannot be installed
+automatically and must be installed to the system using your package manager.
+
+On apt-based systems:
+
+ sudo apt-get install python-gobject
+
+On yum-based systems:
+
+ sudo yum install python-gobject
+
+The installation not work as expected without this dependency.
+""")
+
+ try:
+ import Xlib
+ except ImportError:
+ sys.stderr.write(
+"""
+Python Xlib does not appear to be installed. This cannot be installed
+automatically and must be installed to the system using your package manager.
+
+On apt-based systems:
+
+ sudo apt-get install python-xlib
+
+On yum-based systems:
+
+ sudo yum install python-xlib
+
+The installation not work as expected without this dependency.
+""")
+
+ try:
+ import cv2
+ except ImportError:
+ sys.stderr.write(
+"""
+OpenCV does not appear to be installed. This cannot be installed
+automatically and must be installed to the system using your package manager.
+
+On apt-based systems:
+
+ sudo apt-get install python-opencv
+
+On yum-based systems:
+
+ sudo yum install python-opencv
+
+The installation not work as expected without this dependency.
+""")
+
+ egg_info.run(self)
+
+
+class InstallCommand(install):
+
+ def run(self):
+ print "Compiling language files..."
+
+ install.run(self)
+
+
setup(
name="mousetrap",
version=__version__,
@@ -37,6 +111,10 @@ setup(
include_package_data=True,
install_requires=requirements,
packages=find_packages("src"),
+ cmdclass={
+ "egg_info": EggInfoCommand,
+ "install": InstallCommand,
+ },
package_dir={
"": "src",
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]