mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
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).
This commit is contained in:
parent
516592f4ff
commit
84667c063a
3 changed files with 11 additions and 7 deletions
|
@ -69,7 +69,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
import sys, os
|
import sys, os
|
||||||
import types
|
import types
|
||||||
import textwrap
|
import textwrap
|
||||||
from gettext import gettext as _
|
try:
|
||||||
|
from gettext import gettext as _
|
||||||
|
except ImportError:
|
||||||
|
_ = lambda arg: arg
|
||||||
|
|
||||||
def _repr(self):
|
def _repr(self):
|
||||||
return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self)
|
return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self)
|
||||||
|
|
|
@ -25,6 +25,8 @@ Extension Modules
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- optparse now optionally imports gettext. This allows its use in setup.py.
|
||||||
|
|
||||||
- the deprecated tzparse module was removed.
|
- the deprecated tzparse module was removed.
|
||||||
|
|
||||||
- the pickle module no longer uses the deprecated bin parameter.
|
- the pickle module no longer uses the deprecated bin parameter.
|
||||||
|
|
11
setup.py
11
setup.py
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
__version__ = "$Revision$"
|
__version__ = "$Revision$"
|
||||||
|
|
||||||
import sys, os, imp, re, getopt
|
import sys, os, imp, re, optparse
|
||||||
|
|
||||||
from distutils import log
|
from distutils import log
|
||||||
from distutils import sysconfig
|
from distutils import sysconfig
|
||||||
|
@ -253,11 +253,10 @@ class PyBuildExt(build_ext):
|
||||||
('CPPFLAGS', '-I', self.compiler.include_dirs)):
|
('CPPFLAGS', '-I', self.compiler.include_dirs)):
|
||||||
env_val = os.getenv(env_var)
|
env_val = os.getenv(env_var)
|
||||||
if env_val:
|
if env_val:
|
||||||
# getopt is used instead of optparse because the latter imports
|
parser = optparse.OptionParser()
|
||||||
# gettext which imports struct which has not been built yet
|
parser.add_option(arg_name, dest="dirs", action="append")
|
||||||
# when this method is needed
|
options = parser.parse_args(env_val.split())[0]
|
||||||
options = getopt.getopt(env_val.split(), arg_name[1] + ':')[0]
|
for directory in options.dirs:
|
||||||
for arg_option, directory in options:
|
|
||||||
add_dir_to_list(dir_list, directory)
|
add_dir_to_list(dir_list, directory)
|
||||||
|
|
||||||
if os.path.normpath(sys.prefix) != '/usr':
|
if os.path.normpath(sys.prefix) != '/usr':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue