aesthete-team team mailing list archive
-
aesthete-team team
-
Mailing list archive
-
Message #00005
Patch: setup.py For: font dependency checking
Hi all,
Please find attached a patch to setup.py which checks for the Linux
Libertine font and aborts if it can't find it. The patch uses the
pangocairo package to do the checking, if it cannot be imported the
build is aborted.
Comments welcome,
Chris.
=== modified file 'setup.py'
--- setup.py 2011-06-20 02:02:25 +0000
+++ setup.py 2011-06-20 23:35:32 +0000
@@ -1,4 +1,11 @@
import os, sys, imp
+
+# We must have pangocairo for dependency checking. Abort if we don't have it
+try :
+ import pangocairo
+except ImportError:
+ sys.exit('The pangocairo module, required to build aesthete, is not present. Aborting build.')
+
from distutils.core import setup
from distutils.command.install import INSTALL_SCHEMES
@@ -15,14 +22,21 @@
help_files = map(lambda e : 'help/'+e, os.listdir('./help'))
defs_files = map(lambda e : 'defs/'+e, os.listdir('./defs'))
-# Check dependencies, bail if not present
+# Check python dependencies, bail if not present
package_deps = [['numpy', '1.4.1'], ['scipy', '0.7.2'], ['sympy', '0.6.7'], ['cairo', '1.8.8'], ['gobject', '2.21.5'], ['gtk', '2.17.0'], \
['Image', '1.1.7']]
for package_dep in package_deps :
try :
imp.find_module(package_dep[0])
except ImportError :
- sys.exit(package_dep[0] + ' ' + package_dep[1] + ' or higher is required to use aesthete')
+ sys.exit(package_dep[0] + ' ' + package_dep[1] + ' or higher is required to use aesthete. Aborting build.')
+
+# Check font dependencies (uses pangocairo)
+# (partially lifted from http://cairographics.org/pycairo_pango/)
+font_map = pangocairo.cairo_font_map_get_default()
+family_names = [f.get_name() for f in font_map.list_families()]
+if not 'Linux Libertine' in family_names :
+ sys.exit('The Linux Libertine Font package is required to use aesthete. Aborting build.')
setup(name=name,\
version=version_number,\