Enhancement proposal for setup.py
Mauro Cicognini
mcicogni at siosistemi.it
Tue Aug 26 12:45:18 CEST 2003
Hi all,
since we've now got a Build/ directory containing the various setup.cfg
files for the different platforms, I thought we could enhance setup.py
to simply guess the correct CFG and pull that in directly from Build. We
could also make it recognize a debug build and use a debug CFG.
This comes in handy for me, at least, since this way I put my different
configs into two different files which don't clutter the main dir and I
cannot miss settings anymore.
Obviously this should be extended to override this and use a particular
CFG (esp. when cross-compiling), but I'd say it's a start. Here's the diff:
Index: setup.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/setup.py,v
retrieving revision 1.54
diff -u -w -b -r1.54 setup.py
--- setup.py 20 Aug 2003 20:27:10 -0000 1.54
+++ setup.py 26 Aug 2003 10:39:36 -0000
@@ -38,9 +38,17 @@
LDAP_CLASS = OpenLDAP2
+# pull the right CFG in
+if '--debug' in sys.argv:
+ debug = 'debug'
+else:
+ debug = 'release'
+setup_cfg = 'Build/%s-%s.setup.cfg' % (sys.platform, debug)
+print "Using " + setup_cfg
+
#-- Read the [_ldap] section of setup.cfg
cfg = ConfigParser()
-cfg.read('setup.cfg')
+cfg.read(setup_cfg)
if cfg.has_section('_ldap'):
for name in dir(LDAP_CLASS):
if cfg.has_option('_ldap', name):
How's the idea?
Mauro
More information about the python-ldap
mailing list