diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-08 15:51:21 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-08 15:51:21 +0200 |
commit | d6c511a7fb1ed5e7184d8f96efe2b595e34336b8 (patch) | |
tree | 36211f7b518c73bafc0cd4103309de794486e433 /setupinfo.py | |
parent | 55e2ac1c8de4d509b94b51a8ed9a88b20232d10f (diff) | |
download | python-lxml-d6c511a7fb1ed5e7184d8f96efe2b595e34336b8.tar.gz |
Make setup options "--with-xml2-config" and "--with-xslt-config" work again, after accidentally renaming them to "--xml2-config" and "--xslt-config" in 4.5.1.
See https://github.com/lxml/lxml/pull/297#issuecomment-640496325
Diffstat (limited to 'setupinfo.py')
-rw-r--r-- | setupinfo.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/setupinfo.py b/setupinfo.py index cf195245..d777bf37 100644 --- a/setupinfo.py +++ b/setupinfo.py @@ -489,7 +489,8 @@ def has_option(name): return True return False -def option_value(name): + +def option_value(name, deprecated_for=None): for index, option in enumerate(sys.argv): if option == '--' + name: if index+1 >= len(sys.argv): @@ -497,14 +498,26 @@ def option_value(name): 'The option %s requires a value' % option) value = sys.argv[index+1] sys.argv[index:index+2] = [] + if deprecated_for: + print_deprecated_option(name, deprecated_for) return value if option.startswith('--' + name + '='): value = option[len(name)+3:] sys.argv[index:index+1] = [] + if deprecated_for: + print_deprecated_option(name, deprecated_for) return value - env_val = os.getenv(name.upper().replace('-', '_')) + env_name = name.upper().replace('-', '_') + env_val = os.getenv(env_name) + if env_val and deprecated_for: + print_deprecated_option(env_name, deprecated_for.upper().replace('-', '_')) return env_val + +def print_deprecated_option(name, new_name): + print("WARN: Option '%s' if deprecated. Use '%s' instead." % (name, new_name)) + + staticbuild = bool(os.environ.get('STATICBUILD', '')) # pick up any commandline options and/or env variables OPTION_WITHOUT_OBJECTIFY = has_option('without-objectify') @@ -526,8 +539,8 @@ OPTION_AUTO_RPATH = has_option('auto-rpath') OPTION_BUILD_LIBXML2XSLT = staticbuild or has_option('static-deps') if OPTION_BUILD_LIBXML2XSLT: OPTION_STATIC = True -OPTION_WITH_XML2_CONFIG = option_value('xml2-config') -OPTION_WITH_XSLT_CONFIG = option_value('xslt-config') +OPTION_WITH_XML2_CONFIG = option_value('with-xml2-config') or option_value('xml2-config', deprecated_for='with-xml2-config') +OPTION_WITH_XSLT_CONFIG = option_value('with-xslt-config') or option_value('xslt-config', deprecated_for='with-xslt-config') OPTION_LIBXML2_VERSION = option_value('libxml2-version') OPTION_LIBXSLT_VERSION = option_value('libxslt-version') OPTION_LIBICONV_VERSION = option_value('libiconv-version') |