[pygtk] setup.py: check python version, pygobject and pkgconfig availability before anything else
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygtk] setup.py: check python version, pygobject and pkgconfig availability before anything else
- Date: Thu, 4 Nov 2010 22:46:45 +0000 (UTC)
commit 9da28ecf9be7c40198eb900375dcae8c4085274d
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date: Wed Nov 3 10:50:56 2010 +0100
setup.py: check python version, pygobject and pkgconfig availability before anything else
setup.py | 34 +++++++++++++++++++++-------------
1 files changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/setup.py b/setup.py
index 0d62b00..b8c9839 100755
--- a/setup.py
+++ b/setup.py
@@ -20,11 +20,6 @@ import glob
from distutils.command.build import build
from distutils.core import setup
-from dsextras import get_m4_define, getoutput, have_pkgconfig, \
- pkgc_version_check, getoutput, \
- GLOBAL_INC, GLOBAL_MACROS, InstallLib, InstallData, BuildExt, \
- PkgConfigExtension, Template, TemplateExtension
-
# Check for windows platform
if sys.platform != 'win32':
@@ -34,8 +29,29 @@ if sys.platform != 'win32':
msg += '*' * 68
raise SystemExit(msg)
+# Check for python version
MIN_PYTHON_VERSION = (2, 6, 0)
+if sys.version_info[:3] < MIN_PYTHON_VERSION:
+ raise SystemExit('ERROR: Python %s or higher is required, %s found.' % (
+ '.'.join(map(str,MIN_PYTHON_VERSION)),
+ '.'.join(map(str,sys.version_info[:3]))))
+
+# Check for pygobject (dsextras)
+try:
+ from dsextras import GLOBAL_MACROS, GLOBAL_INC, get_m4_define, getoutput, \
+ have_pkgconfig, pkgc_version_check, pkgc_get_defs_dir, \
+ PkgConfigExtension, Template, TemplateExtension, \
+ BuildExt, InstallLib, InstallData
+except ImportError:
+ raise SystemExit('ERROR: Could not import dsextras module: '
+ 'Make sure you have installed pygobject.')
+
+# Check for pkgconfig
+if not have_pkgconfig():
+ raise SystemExit('ERROR: Could not find pkg-config: '
+ 'Please check your PATH environment variable.')
+
MAJOR_VERSION = int(get_m4_define('pygtk_major_version'))
MINOR_VERSION = int(get_m4_define('pygtk_minor_version'))
MICRO_VERSION = int(get_m4_define('pygtk_micro_version'))
@@ -61,14 +77,6 @@ GLOBAL_MACROS += [('PYGTK_MAJOR_VERSION', MAJOR_VERSION),
('PLATFORM_WIN32',1),
('HAVE_BIND_TEXTDOMAIN_CODESET',1)]
-if sys.version_info[:3] < MIN_PYTHON_VERSION:
- raise SystemExit("Python %s or higher is required, %s found" % (
- ".".join(map(str,MIN_PYTHON_VERSION)),
- ".".join(map(str,sys.version_info[:3]))))
-
-if not have_pkgconfig():
- raise SystemExit("Error, could not find pkg-config")
-
DEFS_DIR = os.path.join('share', 'pygtk', PYGTK_SUFFIX, 'defs')
INCLUDE_DIR = os.path.join('include', 'pygtk-%s' % PYGTK_SUFFIX)
PYGOBJECT_DEFSDIR = getoutput('pkg-config --variable=defsdir pygobject-2.0')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]