[Python-checkins] python/dist/src setup.py,1.205,1.206

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Tue Dec 7 04:25:50 CET 2004


Update of /cvsroot/python/python/dist/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7014

Modified Files:
	setup.py 
Log Message:
Change code in setup.py for parsing LDFLAGS and CPPFLAGS to use optparse
instead of getopt.  Required making use of gettext._ as optional (optparse
changed OK'ed by Greg Ward in private email).


Index: setup.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/setup.py,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- setup.py	7 Dec 2004 00:42:58 -0000	1.205
+++ setup.py	7 Dec 2004 03:25:18 -0000	1.206
@@ -3,7 +3,7 @@
 
 __version__ = "$Revision$"
 
-import sys, os, imp, re, getopt
+import sys, os, imp, re, optparse
 
 from distutils import log
 from distutils import sysconfig
@@ -253,11 +253,10 @@
                 ('CPPFLAGS', '-I', self.compiler.include_dirs)):
             env_val = os.getenv(env_var)
             if env_val:
-                # getopt is used instead of optparse because the latter imports
-                # gettext which imports struct which has not been built yet
-                # when this method is needed
-                options = getopt.getopt(env_val.split(), arg_name[1] + ':')[0]
-                for arg_option, directory in options:
+                parser = optparse.OptionParser()
+                parser.add_option(arg_name, dest="dirs", action="append")
+                options = parser.parse_args(env_val.split())[0]
+                for directory in options.dirs:
                     add_dir_to_list(dir_list, directory)
 
         if os.path.normpath(sys.prefix) != '/usr':



More information about the Python-checkins mailing list