[pre-commit.ci lite] apply automatic fixes
This commit is contained in:
parent
1ae3ad92c4
commit
5ed4b162da
45 changed files with 840 additions and 784 deletions
5
app.py
5
app.py
|
|
@ -2,6 +2,7 @@ from flask import Flask
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/')
|
|
||||||
|
@app.route("/")
|
||||||
def hello():
|
def hello():
|
||||||
return '👋 Hello from Staging Environment!'
|
return "👋 Hello from Staging Environment!"
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,3 @@ Generator: setuptools (75.2.0)
|
||||||
Root-Is-Purelib: false
|
Root-Is-Purelib: false
|
||||||
Tag: cp310-cp310-manylinux_2_17_x86_64
|
Tag: cp310-cp310-manylinux_2_17_x86_64
|
||||||
Tag: cp310-cp310-manylinux2014_x86_64
|
Tag: cp310-cp310-manylinux2014_x86_64
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,3 @@ Round 2!
|
||||||
This is round two.
|
This is round two.
|
||||||
Round 3!
|
Round 3!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,3 @@ contribute, including reporting issues, requesting features, asking or answering
|
||||||
questions, and making PRs.
|
questions, and making PRs.
|
||||||
|
|
||||||
[contrib]: https://palletsprojects.com/contributing/
|
[contrib]: https://palletsprojects.com/contributing/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,4 +86,3 @@ contribute, including reporting issues, requesting features, asking or answering
|
||||||
questions, and making PRs.
|
questions, and making PRs.
|
||||||
|
|
||||||
[contrib]: https://palletsprojects.com/contributing/
|
[contrib]: https://palletsprojects.com/contributing/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
[console_scripts]
|
[console_scripts]
|
||||||
flask=flask.cli:main
|
flask=flask.cli:main
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,3 @@ Wheel-Version: 1.0
|
||||||
Generator: setuptools (72.1.0)
|
Generator: setuptools (72.1.0)
|
||||||
Root-Is-Purelib: true
|
Root-Is-Purelib: true
|
||||||
Tag: py3-none-any
|
Tag: py3-none-any
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,3 @@ users, and allow the maintainers to devote more time to the projects,
|
||||||
[please donate today][].
|
[please donate today][].
|
||||||
|
|
||||||
[please donate today]: https://palletsprojects.com/donate
|
[please donate today]: https://palletsprojects.com/donate
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,4 +81,3 @@ contribute, including reporting issues, requesting features, asking or answering
|
||||||
questions, and making PRs.
|
questions, and making PRs.
|
||||||
|
|
||||||
[contrib]: https://palletsprojects.com/contributing/
|
[contrib]: https://palletsprojects.com/contributing/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
[babel.extractors]
|
[babel.extractors]
|
||||||
jinja2=jinja2.ext:babel_extract[i18n]
|
jinja2=jinja2.ext:babel_extract[i18n]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,4 +102,3 @@ Please review the ``CHANGELOG.rst`` file or the `Changelog documentation`_ for
|
||||||
recent changes and project history.
|
recent changes and project history.
|
||||||
|
|
||||||
.. _`Changelog documentation`: https://packaging.pypa.io/en/latest/changelog/
|
.. _`Changelog documentation`: https://packaging.pypa.io/en/latest/changelog/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,5 +88,3 @@ rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.
|
||||||
.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa
|
.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa
|
||||||
.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev
|
.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev
|
||||||
.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
|
.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,3 @@ Wheel-Version: 1.0
|
||||||
Generator: bdist_wheel (0.37.1)
|
Generator: bdist_wheel (0.37.1)
|
||||||
Root-Is-Purelib: true
|
Root-Is-Purelib: true
|
||||||
Tag: py3-none-any
|
Tag: py3-none-any
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,3 @@
|
||||||
pip = pip._internal.cli.main:main
|
pip = pip._internal.cli.main:main
|
||||||
pip3 = pip._internal.cli.main:main
|
pip3 = pip._internal.cli.main:main
|
||||||
pip3.10 = pip._internal.cli.main:main
|
pip3.10 = pip._internal.cli.main:main
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -383,4 +383,3 @@ BIG5_CHAR_TO_FREQ_ORDER = (
|
||||||
890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360
|
890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360
|
||||||
2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376
|
2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -242,5 +242,3 @@ ISO2022KR_SM_MODEL = {'class_table': ISO2022KR_CLS,
|
||||||
'char_len_table': ISO2022KR_CHAR_LEN_TABLE,
|
'char_len_table': ISO2022KR_CHAR_LEN_TABLE,
|
||||||
'name': "ISO-2022-KR",
|
'name': "ISO-2022-KR",
|
||||||
'language': 'Korean'}
|
'language': 'Korean'}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,4 +192,3 @@ EUCKR_CHAR_TO_FREQ_ORDER = (
|
||||||
2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042,
|
2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042,
|
||||||
670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, # 512, 256
|
670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, # 512, 256
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -384,4 +384,3 @@ EUCTW_CHAR_TO_FREQ_ORDER = (
|
||||||
890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, # 8086
|
890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, # 8086
|
||||||
2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, # 8102
|
2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, # 8102
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,4 +280,3 @@ GB2312_CHAR_TO_FREQ_ORDER = (
|
||||||
381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189,
|
381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189,
|
||||||
852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, #last 512
|
852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, #last 512
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -321,5 +321,3 @@ JIS_CHAR_TO_FREQ_ORDER = (
|
||||||
1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, # 4352
|
1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, # 4352
|
||||||
2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, # 4368 #last 512
|
2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, # 4368 #last 512
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,5 +229,3 @@ class EUCJPContextAnalysis(JapaneseContextAnalysis):
|
||||||
return second_char - 0xA1, char_len
|
return second_char - 0xA1, char_len
|
||||||
|
|
||||||
return -1, char_len
|
return -1, char_len
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4647,4 +4647,3 @@ WINDOWS_1251_BULGARIAN_MODEL = SingleByteCharSetModel(charset_name='windows-1251
|
||||||
typical_positive_ratio=0.969392,
|
typical_positive_ratio=0.969392,
|
||||||
keep_ascii_letters=False,
|
keep_ascii_letters=False,
|
||||||
alphabet='АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЬЮЯабвгдежзийклмнопрстуфхцчшщъьюя')
|
alphabet='АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЬЮЯабвгдежзийклмнопрстуфхцчшщъьюя')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4395,4 +4395,3 @@ ISO_8859_7_GREEK_MODEL = SingleByteCharSetModel(charset_name='ISO-8859-7',
|
||||||
typical_positive_ratio=0.982851,
|
typical_positive_ratio=0.982851,
|
||||||
keep_ascii_letters=False,
|
keep_ascii_letters=False,
|
||||||
alphabet='ΆΈΉΊΌΎΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩάέήίαβγδεζηθικλμνξοπρςστυφχψωόύώ')
|
alphabet='ΆΈΉΊΌΎΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩάέήίαβγδεζηθικλμνξοπρςστυφχψωόύώ')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4380,4 +4380,3 @@ WINDOWS_1255_HEBREW_MODEL = SingleByteCharSetModel(charset_name='windows-1255',
|
||||||
typical_positive_ratio=0.984004,
|
typical_positive_ratio=0.984004,
|
||||||
keep_ascii_letters=False,
|
keep_ascii_letters=False,
|
||||||
alphabet='אבגדהוזחטיךכלםמןנסעףפץצקרשתװױײ')
|
alphabet='אבגדהוזחטיךכלםמןנסעףפץצקרשתװױײ')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4647,4 +4647,3 @@ ISO_8859_2_HUNGARIAN_MODEL = SingleByteCharSetModel(charset_name='ISO-8859-2',
|
||||||
typical_positive_ratio=0.947368,
|
typical_positive_ratio=0.947368,
|
||||||
keep_ascii_letters=True,
|
keep_ascii_letters=True,
|
||||||
alphabet='ABCDEFGHIJKLMNOPRSTUVZabcdefghijklmnoprstuvzÁÉÍÓÖÚÜáéíóöúüŐőŰű')
|
alphabet='ABCDEFGHIJKLMNOPRSTUVZabcdefghijklmnoprstuvzÁÉÍÓÖÚÜáéíóöúüŐőŰű')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5715,4 +5715,3 @@ ISO_8859_5_RUSSIAN_MODEL = SingleByteCharSetModel(charset_name='ISO-8859-5',
|
||||||
typical_positive_ratio=0.976601,
|
typical_positive_ratio=0.976601,
|
||||||
keep_ascii_letters=False,
|
keep_ascii_letters=False,
|
||||||
alphabet='ЁАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё')
|
alphabet='ЁАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4380,4 +4380,3 @@ TIS_620_THAI_MODEL = SingleByteCharSetModel(charset_name='TIS-620',
|
||||||
typical_positive_ratio=0.926386,
|
typical_positive_ratio=0.926386,
|
||||||
keep_ascii_letters=False,
|
keep_ascii_letters=False,
|
||||||
alphabet='กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛')
|
alphabet='กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4380,4 +4380,3 @@ ISO_8859_9_TURKISH_MODEL = SingleByteCharSetModel(charset_name='ISO-8859-9',
|
||||||
typical_positive_ratio=0.97029,
|
typical_positive_ratio=0.97029,
|
||||||
keep_ascii_letters=True,
|
keep_ascii_letters=True,
|
||||||
alphabet='ABCDEFGHIJKLMNOPRSTUVYZabcdefghijklmnoprstuvyzÂÇÎÖÛÜâçîöûüĞğİıŞş')
|
alphabet='ABCDEFGHIJKLMNOPRSTUVYZabcdefghijklmnoprstuvyzÂÇÎÖÛÜâçîöûüĞğİıŞş')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,3 @@ def ToUnicode(label: Union[bytes, bytearray]) -> str:
|
||||||
|
|
||||||
def nameprep(s: Any) -> None:
|
def nameprep(s: Any) -> None:
|
||||||
raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol')
|
raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
__version__ = '3.3'
|
__version__ = '3.3'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,3 @@ def highlight(code, lexer, formatter, outfile=None):
|
||||||
it is returned as a string.
|
it is returned as a string.
|
||||||
"""
|
"""
|
||||||
return format(lex(code, lexer), formatter, outfile)
|
return format(lex(code, lexer), formatter, outfile)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,5 +121,3 @@ Security Contact
|
||||||
To report a security vulnerability, please use the
|
To report a security vulnerability, please use the
|
||||||
`Tidelift security contact <https://tidelift.com/security>`_.
|
`Tidelift security contact <https://tidelift.com/security>`_.
|
||||||
Tidelift will coordinate the fix and disclosure.
|
Tidelift will coordinate the fix and disclosure.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,55 @@
|
||||||
Wheel-Version: 1.0
|
[distutils.commands]
|
||||||
Generator: bdist_wheel (0.37.1)
|
alias = setuptools.command.alias:alias
|
||||||
Root-Is-Purelib: true
|
bdist_egg = setuptools.command.bdist_egg:bdist_egg
|
||||||
Tag: py3-none-any
|
bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
|
||||||
|
build_clib = setuptools.command.build_clib:build_clib
|
||||||
|
build_ext = setuptools.command.build_ext:build_ext
|
||||||
|
build_py = setuptools.command.build_py:build_py
|
||||||
|
develop = setuptools.command.develop:develop
|
||||||
|
dist_info = setuptools.command.dist_info:dist_info
|
||||||
|
easy_install = setuptools.command.easy_install:easy_install
|
||||||
|
egg_info = setuptools.command.egg_info:egg_info
|
||||||
|
install = setuptools.command.install:install
|
||||||
|
install_egg_info = setuptools.command.install_egg_info:install_egg_info
|
||||||
|
install_lib = setuptools.command.install_lib:install_lib
|
||||||
|
install_scripts = setuptools.command.install_scripts:install_scripts
|
||||||
|
rotate = setuptools.command.rotate:rotate
|
||||||
|
saveopts = setuptools.command.saveopts:saveopts
|
||||||
|
sdist = setuptools.command.sdist:sdist
|
||||||
|
setopt = setuptools.command.setopt:setopt
|
||||||
|
test = setuptools.command.test:test
|
||||||
|
upload_docs = setuptools.command.upload_docs:upload_docs
|
||||||
|
|
||||||
|
[distutils.setup_keywords]
|
||||||
|
dependency_links = setuptools.dist:assert_string_list
|
||||||
|
eager_resources = setuptools.dist:assert_string_list
|
||||||
|
entry_points = setuptools.dist:check_entry_points
|
||||||
|
exclude_package_data = setuptools.dist:check_package_data
|
||||||
|
extras_require = setuptools.dist:check_extras
|
||||||
|
include_package_data = setuptools.dist:assert_bool
|
||||||
|
install_requires = setuptools.dist:check_requirements
|
||||||
|
namespace_packages = setuptools.dist:check_nsp
|
||||||
|
package_data = setuptools.dist:check_package_data
|
||||||
|
packages = setuptools.dist:check_packages
|
||||||
|
python_requires = setuptools.dist:check_specifier
|
||||||
|
setup_requires = setuptools.dist:check_requirements
|
||||||
|
test_loader = setuptools.dist:check_importable
|
||||||
|
test_runner = setuptools.dist:check_importable
|
||||||
|
test_suite = setuptools.dist:check_test_suite
|
||||||
|
tests_require = setuptools.dist:check_requirements
|
||||||
|
use_2to3 = setuptools.dist:invalid_unless_false
|
||||||
|
zip_safe = setuptools.dist:assert_bool
|
||||||
|
|
||||||
|
[egg_info.writers]
|
||||||
|
PKG-INFO = setuptools.command.egg_info:write_pkg_info
|
||||||
|
dependency_links.txt = setuptools.command.egg_info:overwrite_arg
|
||||||
|
depends.txt = setuptools.command.egg_info:warn_depends_obsolete
|
||||||
|
eager_resources.txt = setuptools.command.egg_info:overwrite_arg
|
||||||
|
entry_points.txt = setuptools.command.egg_info:write_entries
|
||||||
|
namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
|
||||||
|
requires.txt = setuptools.command.egg_info:write_requirements
|
||||||
|
top_level.txt = setuptools.command.egg_info:write_toplevel_names
|
||||||
|
|
||||||
|
[setuptools.finalize_distribution_options]
|
||||||
|
keywords = setuptools.dist:Distribution._finalize_setup_keywords
|
||||||
|
parent_finalize = setuptools.dist:_Distribution.finalize_options
|
||||||
|
|
|
||||||
|
|
@ -1,56 +1,425 @@
|
||||||
[distutils.commands]
|
"""distutils.cygwinccompiler
|
||||||
alias = setuptools.command.alias:alias
|
|
||||||
bdist_egg = setuptools.command.bdist_egg:bdist_egg
|
|
||||||
bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
|
|
||||||
build_clib = setuptools.command.build_clib:build_clib
|
|
||||||
build_ext = setuptools.command.build_ext:build_ext
|
|
||||||
build_py = setuptools.command.build_py:build_py
|
|
||||||
develop = setuptools.command.develop:develop
|
|
||||||
dist_info = setuptools.command.dist_info:dist_info
|
|
||||||
easy_install = setuptools.command.easy_install:easy_install
|
|
||||||
egg_info = setuptools.command.egg_info:egg_info
|
|
||||||
install = setuptools.command.install:install
|
|
||||||
install_egg_info = setuptools.command.install_egg_info:install_egg_info
|
|
||||||
install_lib = setuptools.command.install_lib:install_lib
|
|
||||||
install_scripts = setuptools.command.install_scripts:install_scripts
|
|
||||||
rotate = setuptools.command.rotate:rotate
|
|
||||||
saveopts = setuptools.command.saveopts:saveopts
|
|
||||||
sdist = setuptools.command.sdist:sdist
|
|
||||||
setopt = setuptools.command.setopt:setopt
|
|
||||||
test = setuptools.command.test:test
|
|
||||||
upload_docs = setuptools.command.upload_docs:upload_docs
|
|
||||||
|
|
||||||
[distutils.setup_keywords]
|
Provides the CygwinCCompiler class, a subclass of UnixCCompiler that
|
||||||
dependency_links = setuptools.dist:assert_string_list
|
handles the Cygwin port of the GNU C compiler to Windows. It also contains
|
||||||
eager_resources = setuptools.dist:assert_string_list
|
the Mingw32CCompiler class which handles the mingw32 port of GCC (same as
|
||||||
entry_points = setuptools.dist:check_entry_points
|
cygwin in no-cygwin mode).
|
||||||
exclude_package_data = setuptools.dist:check_package_data
|
"""
|
||||||
extras_require = setuptools.dist:check_extras
|
|
||||||
include_package_data = setuptools.dist:assert_bool
|
|
||||||
install_requires = setuptools.dist:check_requirements
|
|
||||||
namespace_packages = setuptools.dist:check_nsp
|
|
||||||
package_data = setuptools.dist:check_package_data
|
|
||||||
packages = setuptools.dist:check_packages
|
|
||||||
python_requires = setuptools.dist:check_specifier
|
|
||||||
setup_requires = setuptools.dist:check_requirements
|
|
||||||
test_loader = setuptools.dist:check_importable
|
|
||||||
test_runner = setuptools.dist:check_importable
|
|
||||||
test_suite = setuptools.dist:check_test_suite
|
|
||||||
tests_require = setuptools.dist:check_requirements
|
|
||||||
use_2to3 = setuptools.dist:invalid_unless_false
|
|
||||||
zip_safe = setuptools.dist:assert_bool
|
|
||||||
|
|
||||||
[egg_info.writers]
|
# problems:
|
||||||
PKG-INFO = setuptools.command.egg_info:write_pkg_info
|
#
|
||||||
dependency_links.txt = setuptools.command.egg_info:overwrite_arg
|
# * if you use a msvc compiled python version (1.5.2)
|
||||||
depends.txt = setuptools.command.egg_info:warn_depends_obsolete
|
# 1. you have to insert a __GNUC__ section in its config.h
|
||||||
eager_resources.txt = setuptools.command.egg_info:overwrite_arg
|
# 2. you have to generate an import library for its dll
|
||||||
entry_points.txt = setuptools.command.egg_info:write_entries
|
# - create a def-file for python??.dll
|
||||||
namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
|
# - create an import library using
|
||||||
requires.txt = setuptools.command.egg_info:write_requirements
|
# dlltool --dllname python15.dll --def python15.def \
|
||||||
top_level.txt = setuptools.command.egg_info:write_toplevel_names
|
# --output-lib libpython15.a
|
||||||
|
#
|
||||||
|
# see also http://starship.python.net/crew/kernr/mingw32/Notes.html
|
||||||
|
#
|
||||||
|
# * We put export_symbols in a def-file, and don't use
|
||||||
|
# --export-all-symbols because it doesn't worked reliable in some
|
||||||
|
# tested configurations. And because other windows compilers also
|
||||||
|
# need their symbols specified this no serious problem.
|
||||||
|
#
|
||||||
|
# tested configurations:
|
||||||
|
#
|
||||||
|
# * cygwin gcc 2.91.57/ld 2.9.4/dllwrap 0.2.4 works
|
||||||
|
# (after patching python's config.h and for C++ some other include files)
|
||||||
|
# see also http://starship.python.net/crew/kernr/mingw32/Notes.html
|
||||||
|
# * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works
|
||||||
|
# (ld doesn't support -shared, so we use dllwrap)
|
||||||
|
# * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now
|
||||||
|
# - its dllwrap doesn't work, there is a bug in binutils 2.10.90
|
||||||
|
# see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html
|
||||||
|
# - using gcc -mdll instead dllwrap doesn't work without -static because
|
||||||
|
# it tries to link against dlls instead their import libraries. (If
|
||||||
|
# it finds the dll first.)
|
||||||
|
# By specifying -static we force ld to link against the import libraries,
|
||||||
|
# this is windows standard and there are normally not the necessary symbols
|
||||||
|
# in the dlls.
|
||||||
|
# *** only the version of June 2000 shows these problems
|
||||||
|
# * cygwin gcc 3.2/ld 2.13.90 works
|
||||||
|
# (ld supports -shared)
|
||||||
|
# * mingw gcc 3.2/ld 2.13 works
|
||||||
|
# (ld supports -shared)
|
||||||
|
# * llvm-mingw with Clang 11 works
|
||||||
|
# (lld supports -shared)
|
||||||
|
|
||||||
[setuptools.finalize_distribution_options]
|
import os
|
||||||
keywords = setuptools.dist:Distribution._finalize_setup_keywords
|
import sys
|
||||||
parent_finalize = setuptools.dist:_Distribution.finalize_options
|
import copy
|
||||||
|
from subprocess import Popen, PIPE, check_output
|
||||||
|
import re
|
||||||
|
|
||||||
|
import distutils.version
|
||||||
|
from distutils.unixccompiler import UnixCCompiler
|
||||||
|
from distutils.file_util import write_file
|
||||||
|
from distutils.errors import (DistutilsExecError, CCompilerError,
|
||||||
|
CompileError, UnknownFileError)
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
from distutils.spawn import find_executable
|
||||||
|
|
||||||
|
def get_msvcr():
|
||||||
|
"""Include the appropriate MSVC runtime library if Python was built
|
||||||
|
with MSVC 7.0 or later.
|
||||||
|
"""
|
||||||
|
msc_pos = sys.version.find('MSC v.')
|
||||||
|
if msc_pos != -1:
|
||||||
|
msc_ver = sys.version[msc_pos+6:msc_pos+10]
|
||||||
|
if msc_ver == '1300':
|
||||||
|
# MSVC 7.0
|
||||||
|
return ['msvcr70']
|
||||||
|
elif msc_ver == '1310':
|
||||||
|
# MSVC 7.1
|
||||||
|
return ['msvcr71']
|
||||||
|
elif msc_ver == '1400':
|
||||||
|
# VS2005 / MSVC 8.0
|
||||||
|
return ['msvcr80']
|
||||||
|
elif msc_ver == '1500':
|
||||||
|
# VS2008 / MSVC 9.0
|
||||||
|
return ['msvcr90']
|
||||||
|
elif msc_ver == '1600':
|
||||||
|
# VS2010 / MSVC 10.0
|
||||||
|
return ['msvcr100']
|
||||||
|
elif msc_ver == '1700':
|
||||||
|
# VS2012 / MSVC 11.0
|
||||||
|
return ['msvcr110']
|
||||||
|
elif msc_ver == '1800':
|
||||||
|
# VS2013 / MSVC 12.0
|
||||||
|
return ['msvcr120']
|
||||||
|
elif 1900 <= int(msc_ver) < 2000:
|
||||||
|
# VS2015 / MSVC 14.0
|
||||||
|
return ['ucrt', 'vcruntime140']
|
||||||
|
else:
|
||||||
|
raise ValueError("Unknown MS Compiler version %s " % msc_ver)
|
||||||
|
|
||||||
|
|
||||||
|
class CygwinCCompiler(UnixCCompiler):
|
||||||
|
""" Handles the Cygwin port of the GNU C compiler to Windows.
|
||||||
|
"""
|
||||||
|
compiler_type = 'cygwin'
|
||||||
|
obj_extension = ".o"
|
||||||
|
static_lib_extension = ".a"
|
||||||
|
shared_lib_extension = ".dll"
|
||||||
|
static_lib_format = "lib%s%s"
|
||||||
|
shared_lib_format = "%s%s"
|
||||||
|
exe_extension = ".exe"
|
||||||
|
|
||||||
|
def __init__(self, verbose=0, dry_run=0, force=0):
|
||||||
|
|
||||||
|
UnixCCompiler.__init__(self, verbose, dry_run, force)
|
||||||
|
|
||||||
|
status, details = check_config_h()
|
||||||
|
self.debug_print("Python's GCC status: %s (details: %s)" %
|
||||||
|
(status, details))
|
||||||
|
if status is not CONFIG_H_OK:
|
||||||
|
self.warn(
|
||||||
|
"Python's pyconfig.h doesn't seem to support your compiler. "
|
||||||
|
"Reason: %s. "
|
||||||
|
"Compiling may fail because of undefined preprocessor macros."
|
||||||
|
% details)
|
||||||
|
|
||||||
|
self.cc = os.environ.get('CC', 'gcc')
|
||||||
|
self.cxx = os.environ.get('CXX', 'g++')
|
||||||
|
|
||||||
|
if ('gcc' in self.cc): # Start gcc workaround
|
||||||
|
self.gcc_version, self.ld_version, self.dllwrap_version = \
|
||||||
|
get_versions()
|
||||||
|
self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" %
|
||||||
|
(self.gcc_version,
|
||||||
|
self.ld_version,
|
||||||
|
self.dllwrap_version) )
|
||||||
|
|
||||||
|
# ld_version >= "2.10.90" and < "2.13" should also be able to use
|
||||||
|
# gcc -mdll instead of dllwrap
|
||||||
|
# Older dllwraps had own version numbers, newer ones use the
|
||||||
|
# same as the rest of binutils ( also ld )
|
||||||
|
# dllwrap 2.10.90 is buggy
|
||||||
|
if self.ld_version >= "2.10.90":
|
||||||
|
self.linker_dll = self.cc
|
||||||
|
else:
|
||||||
|
self.linker_dll = "dllwrap"
|
||||||
|
|
||||||
|
# ld_version >= "2.13" support -shared so use it instead of
|
||||||
|
# -mdll -static
|
||||||
|
if self.ld_version >= "2.13":
|
||||||
|
shared_option = "-shared"
|
||||||
|
else:
|
||||||
|
shared_option = "-mdll -static"
|
||||||
|
else: # Assume linker is up to date
|
||||||
|
self.linker_dll = self.cc
|
||||||
|
shared_option = "-shared"
|
||||||
|
|
||||||
|
self.set_executables(compiler='%s -mcygwin -O -Wall' % self.cc,
|
||||||
|
compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc,
|
||||||
|
compiler_cxx='%s -mcygwin -O -Wall' % self.cxx,
|
||||||
|
linker_exe='%s -mcygwin' % self.cc,
|
||||||
|
linker_so=('%s -mcygwin %s' %
|
||||||
|
(self.linker_dll, shared_option)))
|
||||||
|
|
||||||
|
# cygwin and mingw32 need different sets of libraries
|
||||||
|
if ('gcc' in self.cc and self.gcc_version == "2.91.57"):
|
||||||
|
# cygwin shouldn't need msvcrt, but without the dlls will crash
|
||||||
|
# (gcc version 2.91.57) -- perhaps something about initialization
|
||||||
|
self.dll_libraries=["msvcrt"]
|
||||||
|
self.warn(
|
||||||
|
"Consider upgrading to a newer version of gcc")
|
||||||
|
else:
|
||||||
|
# Include the appropriate MSVC runtime library if Python was built
|
||||||
|
# with MSVC 7.0 or later.
|
||||||
|
self.dll_libraries = get_msvcr()
|
||||||
|
|
||||||
|
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
|
||||||
|
"""Compiles the source by spawning GCC and windres if needed."""
|
||||||
|
if ext == '.rc' or ext == '.res':
|
||||||
|
# gcc needs '.res' and '.rc' compiled to object files !!!
|
||||||
|
try:
|
||||||
|
self.spawn(["windres", "-i", src, "-o", obj])
|
||||||
|
except DistutilsExecError as msg:
|
||||||
|
raise CompileError(msg)
|
||||||
|
else: # for other files use the C-compiler
|
||||||
|
try:
|
||||||
|
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
|
||||||
|
extra_postargs)
|
||||||
|
except DistutilsExecError as msg:
|
||||||
|
raise CompileError(msg)
|
||||||
|
|
||||||
|
def link(self, target_desc, objects, output_filename, output_dir=None,
|
||||||
|
libraries=None, library_dirs=None, runtime_library_dirs=None,
|
||||||
|
export_symbols=None, debug=0, extra_preargs=None,
|
||||||
|
extra_postargs=None, build_temp=None, target_lang=None):
|
||||||
|
"""Link the objects."""
|
||||||
|
# use separate copies, so we can modify the lists
|
||||||
|
extra_preargs = copy.copy(extra_preargs or [])
|
||||||
|
libraries = copy.copy(libraries or [])
|
||||||
|
objects = copy.copy(objects or [])
|
||||||
|
|
||||||
|
# Additional libraries
|
||||||
|
libraries.extend(self.dll_libraries)
|
||||||
|
|
||||||
|
# handle export symbols by creating a def-file
|
||||||
|
# with executables this only works with gcc/ld as linker
|
||||||
|
if ((export_symbols is not None) and
|
||||||
|
(target_desc != self.EXECUTABLE or self.linker_dll == "gcc")):
|
||||||
|
# (The linker doesn't do anything if output is up-to-date.
|
||||||
|
# So it would probably better to check if we really need this,
|
||||||
|
# but for this we had to insert some unchanged parts of
|
||||||
|
# UnixCCompiler, and this is not what we want.)
|
||||||
|
|
||||||
|
# we want to put some files in the same directory as the
|
||||||
|
# object files are, build_temp doesn't help much
|
||||||
|
# where are the object files
|
||||||
|
temp_dir = os.path.dirname(objects[0])
|
||||||
|
# name of dll to give the helper files the same base name
|
||||||
|
(dll_name, dll_extension) = os.path.splitext(
|
||||||
|
os.path.basename(output_filename))
|
||||||
|
|
||||||
|
# generate the filenames for these files
|
||||||
|
def_file = os.path.join(temp_dir, dll_name + ".def")
|
||||||
|
lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a")
|
||||||
|
|
||||||
|
# Generate .def file
|
||||||
|
contents = [
|
||||||
|
"LIBRARY %s" % os.path.basename(output_filename),
|
||||||
|
"EXPORTS"]
|
||||||
|
for sym in export_symbols:
|
||||||
|
contents.append(sym)
|
||||||
|
self.execute(write_file, (def_file, contents),
|
||||||
|
"writing %s" % def_file)
|
||||||
|
|
||||||
|
# next add options for def-file and to creating import libraries
|
||||||
|
|
||||||
|
# dllwrap uses different options than gcc/ld
|
||||||
|
if self.linker_dll == "dllwrap":
|
||||||
|
extra_preargs.extend(["--output-lib", lib_file])
|
||||||
|
# for dllwrap we have to use a special option
|
||||||
|
extra_preargs.extend(["--def", def_file])
|
||||||
|
# we use gcc/ld here and can be sure ld is >= 2.9.10
|
||||||
|
else:
|
||||||
|
# doesn't work: bfd_close build\...\libfoo.a: Invalid operation
|
||||||
|
#extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file])
|
||||||
|
# for gcc/ld the def-file is specified as any object files
|
||||||
|
objects.append(def_file)
|
||||||
|
|
||||||
|
#end: if ((export_symbols is not None) and
|
||||||
|
# (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")):
|
||||||
|
|
||||||
|
# who wants symbols and a many times larger output file
|
||||||
|
# should explicitly switch the debug mode on
|
||||||
|
# otherwise we let dllwrap/ld strip the output file
|
||||||
|
# (On my machine: 10KiB < stripped_file < ??100KiB
|
||||||
|
# unstripped_file = stripped_file + XXX KiB
|
||||||
|
# ( XXX=254 for a typical python extension))
|
||||||
|
if not debug:
|
||||||
|
extra_preargs.append("-s")
|
||||||
|
|
||||||
|
UnixCCompiler.link(self, target_desc, objects, output_filename,
|
||||||
|
output_dir, libraries, library_dirs,
|
||||||
|
runtime_library_dirs,
|
||||||
|
None, # export_symbols, we do this in our def-file
|
||||||
|
debug, extra_preargs, extra_postargs, build_temp,
|
||||||
|
target_lang)
|
||||||
|
|
||||||
|
# -- Miscellaneous methods -----------------------------------------
|
||||||
|
|
||||||
|
def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
|
||||||
|
"""Adds supports for rc and res files."""
|
||||||
|
if output_dir is None:
|
||||||
|
output_dir = ''
|
||||||
|
obj_names = []
|
||||||
|
for src_name in source_filenames:
|
||||||
|
# use normcase to make sure '.rc' is really '.rc' and not '.RC'
|
||||||
|
base, ext = os.path.splitext(os.path.normcase(src_name))
|
||||||
|
if ext not in (self.src_extensions + ['.rc','.res']):
|
||||||
|
raise UnknownFileError("unknown file type '%s' (from '%s')" % \
|
||||||
|
(ext, src_name))
|
||||||
|
if strip_dir:
|
||||||
|
base = os.path.basename (base)
|
||||||
|
if ext in ('.res', '.rc'):
|
||||||
|
# these need to be compiled to object files
|
||||||
|
obj_names.append (os.path.join(output_dir,
|
||||||
|
base + ext + self.obj_extension))
|
||||||
|
else:
|
||||||
|
obj_names.append (os.path.join(output_dir,
|
||||||
|
base + self.obj_extension))
|
||||||
|
return obj_names
|
||||||
|
|
||||||
|
# the same as cygwin plus some additional parameters
|
||||||
|
class Mingw32CCompiler(CygwinCCompiler):
|
||||||
|
""" Handles the Mingw32 port of the GNU C compiler to Windows.
|
||||||
|
"""
|
||||||
|
compiler_type = 'mingw32'
|
||||||
|
|
||||||
|
def __init__(self, verbose=0, dry_run=0, force=0):
|
||||||
|
|
||||||
|
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
|
||||||
|
|
||||||
|
# ld_version >= "2.13" support -shared so use it instead of
|
||||||
|
# -mdll -static
|
||||||
|
if ('gcc' in self.cc and self.ld_version < "2.13"):
|
||||||
|
shared_option = "-mdll -static"
|
||||||
|
else:
|
||||||
|
shared_option = "-shared"
|
||||||
|
|
||||||
|
# A real mingw32 doesn't need to specify a different entry point,
|
||||||
|
# but cygwin 2.91.57 in no-cygwin-mode needs it.
|
||||||
|
if ('gcc' in self.cc and self.gcc_version <= "2.91.57"):
|
||||||
|
entry_point = '--entry _DllMain@12'
|
||||||
|
else:
|
||||||
|
entry_point = ''
|
||||||
|
|
||||||
|
if is_cygwincc(self.cc):
|
||||||
|
raise CCompilerError(
|
||||||
|
'Cygwin gcc cannot be used with --compiler=mingw32')
|
||||||
|
|
||||||
|
self.set_executables(compiler='%s -O -Wall' % self.cc,
|
||||||
|
compiler_so='%s -mdll -O -Wall' % self.cc,
|
||||||
|
compiler_cxx='%s -O -Wall' % self.cxx,
|
||||||
|
linker_exe='%s' % self.cc,
|
||||||
|
linker_so='%s %s %s'
|
||||||
|
% (self.linker_dll, shared_option,
|
||||||
|
entry_point))
|
||||||
|
# Maybe we should also append -mthreads, but then the finished
|
||||||
|
# dlls need another dll (mingwm10.dll see Mingw32 docs)
|
||||||
|
# (-mthreads: Support thread-safe exception handling on `Mingw32')
|
||||||
|
|
||||||
|
# no additional libraries needed
|
||||||
|
self.dll_libraries=[]
|
||||||
|
|
||||||
|
# Include the appropriate MSVC runtime library if Python was built
|
||||||
|
# with MSVC 7.0 or later.
|
||||||
|
self.dll_libraries = get_msvcr()
|
||||||
|
|
||||||
|
# Because these compilers aren't configured in Python's pyconfig.h file by
|
||||||
|
# default, we should at least warn the user if he is using an unmodified
|
||||||
|
# version.
|
||||||
|
|
||||||
|
CONFIG_H_OK = "ok"
|
||||||
|
CONFIG_H_NOTOK = "not ok"
|
||||||
|
CONFIG_H_UNCERTAIN = "uncertain"
|
||||||
|
|
||||||
|
def check_config_h():
|
||||||
|
"""Check if the current Python installation appears amenable to building
|
||||||
|
extensions with GCC.
|
||||||
|
|
||||||
|
Returns a tuple (status, details), where 'status' is one of the following
|
||||||
|
constants:
|
||||||
|
|
||||||
|
- CONFIG_H_OK: all is well, go ahead and compile
|
||||||
|
- CONFIG_H_NOTOK: doesn't look good
|
||||||
|
- CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h
|
||||||
|
|
||||||
|
'details' is a human-readable string explaining the situation.
|
||||||
|
|
||||||
|
Note there are two ways to conclude "OK": either 'sys.version' contains
|
||||||
|
the string "GCC" (implying that this Python was built with GCC), or the
|
||||||
|
installed "pyconfig.h" contains the string "__GNUC__".
|
||||||
|
"""
|
||||||
|
|
||||||
|
# XXX since this function also checks sys.version, it's not strictly a
|
||||||
|
# "pyconfig.h" check -- should probably be renamed...
|
||||||
|
|
||||||
|
from distutils import sysconfig
|
||||||
|
|
||||||
|
# if sys.version contains GCC then python was compiled with GCC, and the
|
||||||
|
# pyconfig.h file should be OK
|
||||||
|
if "GCC" in sys.version:
|
||||||
|
return CONFIG_H_OK, "sys.version mentions 'GCC'"
|
||||||
|
|
||||||
|
# Clang would also work
|
||||||
|
if "Clang" in sys.version:
|
||||||
|
return CONFIG_H_OK, "sys.version mentions 'Clang'"
|
||||||
|
|
||||||
|
# let's see if __GNUC__ is mentioned in python.h
|
||||||
|
fn = sysconfig.get_config_h_filename()
|
||||||
|
try:
|
||||||
|
config_h = open(fn)
|
||||||
|
try:
|
||||||
|
if "__GNUC__" in config_h.read():
|
||||||
|
return CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn
|
||||||
|
else:
|
||||||
|
return CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn
|
||||||
|
finally:
|
||||||
|
config_h.close()
|
||||||
|
except OSError as exc:
|
||||||
|
return (CONFIG_H_UNCERTAIN,
|
||||||
|
"couldn't read '%s': %s" % (fn, exc.strerror))
|
||||||
|
|
||||||
|
RE_VERSION = re.compile(br'(\d+\.\d+(\.\d+)*)')
|
||||||
|
|
||||||
|
def _find_exe_version(cmd):
|
||||||
|
"""Find the version of an executable by running `cmd` in the shell.
|
||||||
|
|
||||||
|
If the command is not found, or the output does not match
|
||||||
|
`RE_VERSION`, returns None.
|
||||||
|
"""
|
||||||
|
executable = cmd.split()[0]
|
||||||
|
if find_executable(executable) is None:
|
||||||
|
return None
|
||||||
|
out = Popen(cmd, shell=True, stdout=PIPE).stdout
|
||||||
|
try:
|
||||||
|
out_string = out.read()
|
||||||
|
finally:
|
||||||
|
out.close()
|
||||||
|
result = RE_VERSION.search(out_string)
|
||||||
|
if result is None:
|
||||||
|
return None
|
||||||
|
# LooseVersion works with strings; decode
|
||||||
|
ver_str = result.group(1).decode()
|
||||||
|
with distutils.version.suppress_known_deprecation():
|
||||||
|
return LooseVersion(ver_str)
|
||||||
|
|
||||||
|
def get_versions():
|
||||||
|
""" Try to find out the versions of gcc, ld and dllwrap.
|
||||||
|
|
||||||
|
If not possible it returns None for it.
|
||||||
|
"""
|
||||||
|
commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version']
|
||||||
|
return tuple([_find_exe_version(cmd) for cmd in commands])
|
||||||
|
|
||||||
|
def is_cygwincc(cc):
|
||||||
|
'''Try to determine if the compiler that would be used is from cygwin.'''
|
||||||
|
out_string = check_output([cc, '-dumpmachine'])
|
||||||
|
return out_string.strip().endswith(b'cygwin')
|
||||||
|
|
|
||||||
|
|
@ -1,425 +1,98 @@
|
||||||
"""distutils.cygwinccompiler
|
Metadata-Version: 2.3
|
||||||
|
Name: Werkzeug
|
||||||
|
Version: 3.1.3
|
||||||
|
Summary: The comprehensive WSGI web application library.
|
||||||
|
Maintainer-email: Pallets <contact@palletsprojects.com>
|
||||||
|
Requires-Python: >=3.9
|
||||||
|
Description-Content-Type: text/markdown
|
||||||
|
Classifier: Development Status :: 5 - Production/Stable
|
||||||
|
Classifier: Environment :: Web Environment
|
||||||
|
Classifier: Intended Audience :: Developers
|
||||||
|
Classifier: License :: OSI Approved :: BSD License
|
||||||
|
Classifier: Operating System :: OS Independent
|
||||||
|
Classifier: Programming Language :: Python
|
||||||
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||||
|
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
||||||
|
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
|
||||||
|
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
|
||||||
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
||||||
|
Classifier: Typing :: Typed
|
||||||
|
Requires-Dist: MarkupSafe>=2.1.1
|
||||||
|
Requires-Dist: watchdog>=2.3 ; extra == "watchdog"
|
||||||
|
Project-URL: Changes, https://werkzeug.palletsprojects.com/changes/
|
||||||
|
Project-URL: Chat, https://discord.gg/pallets
|
||||||
|
Project-URL: Documentation, https://werkzeug.palletsprojects.com/
|
||||||
|
Project-URL: Donate, https://palletsprojects.com/donate
|
||||||
|
Project-URL: Issue Tracker, https://github.com/pallets/werkzeug/issues/
|
||||||
|
Project-URL: Source Code, https://github.com/pallets/werkzeug/
|
||||||
|
Provides-Extra: watchdog
|
||||||
|
|
||||||
Provides the CygwinCCompiler class, a subclass of UnixCCompiler that
|
# Werkzeug
|
||||||
handles the Cygwin port of the GNU C compiler to Windows. It also contains
|
|
||||||
the Mingw32CCompiler class which handles the mingw32 port of GCC (same as
|
|
||||||
cygwin in no-cygwin mode).
|
|
||||||
"""
|
|
||||||
|
|
||||||
# problems:
|
*werkzeug* German noun: "tool". Etymology: *werk* ("work"), *zeug* ("stuff")
|
||||||
#
|
|
||||||
# * if you use a msvc compiled python version (1.5.2)
|
|
||||||
# 1. you have to insert a __GNUC__ section in its config.h
|
|
||||||
# 2. you have to generate an import library for its dll
|
|
||||||
# - create a def-file for python??.dll
|
|
||||||
# - create an import library using
|
|
||||||
# dlltool --dllname python15.dll --def python15.def \
|
|
||||||
# --output-lib libpython15.a
|
|
||||||
#
|
|
||||||
# see also http://starship.python.net/crew/kernr/mingw32/Notes.html
|
|
||||||
#
|
|
||||||
# * We put export_symbols in a def-file, and don't use
|
|
||||||
# --export-all-symbols because it doesn't worked reliable in some
|
|
||||||
# tested configurations. And because other windows compilers also
|
|
||||||
# need their symbols specified this no serious problem.
|
|
||||||
#
|
|
||||||
# tested configurations:
|
|
||||||
#
|
|
||||||
# * cygwin gcc 2.91.57/ld 2.9.4/dllwrap 0.2.4 works
|
|
||||||
# (after patching python's config.h and for C++ some other include files)
|
|
||||||
# see also http://starship.python.net/crew/kernr/mingw32/Notes.html
|
|
||||||
# * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works
|
|
||||||
# (ld doesn't support -shared, so we use dllwrap)
|
|
||||||
# * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now
|
|
||||||
# - its dllwrap doesn't work, there is a bug in binutils 2.10.90
|
|
||||||
# see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html
|
|
||||||
# - using gcc -mdll instead dllwrap doesn't work without -static because
|
|
||||||
# it tries to link against dlls instead their import libraries. (If
|
|
||||||
# it finds the dll first.)
|
|
||||||
# By specifying -static we force ld to link against the import libraries,
|
|
||||||
# this is windows standard and there are normally not the necessary symbols
|
|
||||||
# in the dlls.
|
|
||||||
# *** only the version of June 2000 shows these problems
|
|
||||||
# * cygwin gcc 3.2/ld 2.13.90 works
|
|
||||||
# (ld supports -shared)
|
|
||||||
# * mingw gcc 3.2/ld 2.13 works
|
|
||||||
# (ld supports -shared)
|
|
||||||
# * llvm-mingw with Clang 11 works
|
|
||||||
# (lld supports -shared)
|
|
||||||
|
|
||||||
import os
|
Werkzeug is a comprehensive [WSGI][] web application library. It began as
|
||||||
import sys
|
a simple collection of various utilities for WSGI applications and has
|
||||||
import copy
|
become one of the most advanced WSGI utility libraries.
|
||||||
from subprocess import Popen, PIPE, check_output
|
|
||||||
import re
|
|
||||||
|
|
||||||
import distutils.version
|
It includes:
|
||||||
from distutils.unixccompiler import UnixCCompiler
|
|
||||||
from distutils.file_util import write_file
|
|
||||||
from distutils.errors import (DistutilsExecError, CCompilerError,
|
|
||||||
CompileError, UnknownFileError)
|
|
||||||
from distutils.version import LooseVersion
|
|
||||||
from distutils.spawn import find_executable
|
|
||||||
|
|
||||||
def get_msvcr():
|
- An interactive debugger that allows inspecting stack traces and
|
||||||
"""Include the appropriate MSVC runtime library if Python was built
|
source code in the browser with an interactive interpreter for any
|
||||||
with MSVC 7.0 or later.
|
frame in the stack.
|
||||||
"""
|
- A full-featured request object with objects to interact with
|
||||||
msc_pos = sys.version.find('MSC v.')
|
headers, query args, form data, files, and cookies.
|
||||||
if msc_pos != -1:
|
- A response object that can wrap other WSGI applications and handle
|
||||||
msc_ver = sys.version[msc_pos+6:msc_pos+10]
|
streaming data.
|
||||||
if msc_ver == '1300':
|
- A routing system for matching URLs to endpoints and generating URLs
|
||||||
# MSVC 7.0
|
for endpoints, with an extensible system for capturing variables
|
||||||
return ['msvcr70']
|
from URLs.
|
||||||
elif msc_ver == '1310':
|
- HTTP utilities to handle entity tags, cache control, dates, user
|
||||||
# MSVC 7.1
|
agents, cookies, files, and more.
|
||||||
return ['msvcr71']
|
- A threaded WSGI server for use while developing applications
|
||||||
elif msc_ver == '1400':
|
locally.
|
||||||
# VS2005 / MSVC 8.0
|
- A test client for simulating HTTP requests during testing without
|
||||||
return ['msvcr80']
|
requiring running a server.
|
||||||
elif msc_ver == '1500':
|
|
||||||
# VS2008 / MSVC 9.0
|
Werkzeug doesn't enforce any dependencies. It is up to the developer to
|
||||||
return ['msvcr90']
|
choose a template engine, database adapter, and even how to handle
|
||||||
elif msc_ver == '1600':
|
requests. It can be used to build all sorts of end user applications
|
||||||
# VS2010 / MSVC 10.0
|
such as blogs, wikis, or bulletin boards.
|
||||||
return ['msvcr100']
|
|
||||||
elif msc_ver == '1700':
|
[Flask][] wraps Werkzeug, using it to handle the details of WSGI while
|
||||||
# VS2012 / MSVC 11.0
|
providing more structure and patterns for defining powerful
|
||||||
return ['msvcr110']
|
applications.
|
||||||
elif msc_ver == '1800':
|
|
||||||
# VS2013 / MSVC 12.0
|
[WSGI]: https://wsgi.readthedocs.io/en/latest/
|
||||||
return ['msvcr120']
|
[Flask]: https://www.palletsprojects.com/p/flask/
|
||||||
elif 1900 <= int(msc_ver) < 2000:
|
|
||||||
# VS2015 / MSVC 14.0
|
|
||||||
return ['ucrt', 'vcruntime140']
|
|
||||||
else:
|
|
||||||
raise ValueError("Unknown MS Compiler version %s " % msc_ver)
|
|
||||||
|
|
||||||
|
|
||||||
class CygwinCCompiler(UnixCCompiler):
|
## A Simple Example
|
||||||
""" Handles the Cygwin port of the GNU C compiler to Windows.
|
|
||||||
"""
|
|
||||||
compiler_type = 'cygwin'
|
|
||||||
obj_extension = ".o"
|
|
||||||
static_lib_extension = ".a"
|
|
||||||
shared_lib_extension = ".dll"
|
|
||||||
static_lib_format = "lib%s%s"
|
|
||||||
shared_lib_format = "%s%s"
|
|
||||||
exe_extension = ".exe"
|
|
||||||
|
|
||||||
def __init__(self, verbose=0, dry_run=0, force=0):
|
```python
|
||||||
|
# save this as app.py
|
||||||
|
from werkzeug.wrappers import Request, Response
|
||||||
|
|
||||||
UnixCCompiler.__init__(self, verbose, dry_run, force)
|
@Request.application
|
||||||
|
def application(request: Request) -> Response:
|
||||||
|
return Response("Hello, World!")
|
||||||
|
|
||||||
status, details = check_config_h()
|
if __name__ == "__main__":
|
||||||
self.debug_print("Python's GCC status: %s (details: %s)" %
|
from werkzeug.serving import run_simple
|
||||||
(status, details))
|
run_simple("127.0.0.1", 5000, application)
|
||||||
if status is not CONFIG_H_OK:
|
```
|
||||||
self.warn(
|
|
||||||
"Python's pyconfig.h doesn't seem to support your compiler. "
|
|
||||||
"Reason: %s. "
|
|
||||||
"Compiling may fail because of undefined preprocessor macros."
|
|
||||||
% details)
|
|
||||||
|
|
||||||
self.cc = os.environ.get('CC', 'gcc')
|
```
|
||||||
self.cxx = os.environ.get('CXX', 'g++')
|
$ python -m app
|
||||||
|
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
|
||||||
|
```
|
||||||
|
|
||||||
if ('gcc' in self.cc): # Start gcc workaround
|
|
||||||
self.gcc_version, self.ld_version, self.dllwrap_version = \
|
|
||||||
get_versions()
|
|
||||||
self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" %
|
|
||||||
(self.gcc_version,
|
|
||||||
self.ld_version,
|
|
||||||
self.dllwrap_version) )
|
|
||||||
|
|
||||||
# ld_version >= "2.10.90" and < "2.13" should also be able to use
|
## Donate
|
||||||
# gcc -mdll instead of dllwrap
|
|
||||||
# Older dllwraps had own version numbers, newer ones use the
|
|
||||||
# same as the rest of binutils ( also ld )
|
|
||||||
# dllwrap 2.10.90 is buggy
|
|
||||||
if self.ld_version >= "2.10.90":
|
|
||||||
self.linker_dll = self.cc
|
|
||||||
else:
|
|
||||||
self.linker_dll = "dllwrap"
|
|
||||||
|
|
||||||
# ld_version >= "2.13" support -shared so use it instead of
|
The Pallets organization develops and supports Werkzeug and other
|
||||||
# -mdll -static
|
popular packages. In order to grow the community of contributors and
|
||||||
if self.ld_version >= "2.13":
|
users, and allow the maintainers to devote more time to the projects,
|
||||||
shared_option = "-shared"
|
[please donate today][].
|
||||||
else:
|
|
||||||
shared_option = "-mdll -static"
|
|
||||||
else: # Assume linker is up to date
|
|
||||||
self.linker_dll = self.cc
|
|
||||||
shared_option = "-shared"
|
|
||||||
|
|
||||||
self.set_executables(compiler='%s -mcygwin -O -Wall' % self.cc,
|
[please donate today]: https://palletsprojects.com/donate
|
||||||
compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc,
|
|
||||||
compiler_cxx='%s -mcygwin -O -Wall' % self.cxx,
|
|
||||||
linker_exe='%s -mcygwin' % self.cc,
|
|
||||||
linker_so=('%s -mcygwin %s' %
|
|
||||||
(self.linker_dll, shared_option)))
|
|
||||||
|
|
||||||
# cygwin and mingw32 need different sets of libraries
|
|
||||||
if ('gcc' in self.cc and self.gcc_version == "2.91.57"):
|
|
||||||
# cygwin shouldn't need msvcrt, but without the dlls will crash
|
|
||||||
# (gcc version 2.91.57) -- perhaps something about initialization
|
|
||||||
self.dll_libraries=["msvcrt"]
|
|
||||||
self.warn(
|
|
||||||
"Consider upgrading to a newer version of gcc")
|
|
||||||
else:
|
|
||||||
# Include the appropriate MSVC runtime library if Python was built
|
|
||||||
# with MSVC 7.0 or later.
|
|
||||||
self.dll_libraries = get_msvcr()
|
|
||||||
|
|
||||||
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
|
|
||||||
"""Compiles the source by spawning GCC and windres if needed."""
|
|
||||||
if ext == '.rc' or ext == '.res':
|
|
||||||
# gcc needs '.res' and '.rc' compiled to object files !!!
|
|
||||||
try:
|
|
||||||
self.spawn(["windres", "-i", src, "-o", obj])
|
|
||||||
except DistutilsExecError as msg:
|
|
||||||
raise CompileError(msg)
|
|
||||||
else: # for other files use the C-compiler
|
|
||||||
try:
|
|
||||||
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
|
|
||||||
extra_postargs)
|
|
||||||
except DistutilsExecError as msg:
|
|
||||||
raise CompileError(msg)
|
|
||||||
|
|
||||||
def link(self, target_desc, objects, output_filename, output_dir=None,
|
|
||||||
libraries=None, library_dirs=None, runtime_library_dirs=None,
|
|
||||||
export_symbols=None, debug=0, extra_preargs=None,
|
|
||||||
extra_postargs=None, build_temp=None, target_lang=None):
|
|
||||||
"""Link the objects."""
|
|
||||||
# use separate copies, so we can modify the lists
|
|
||||||
extra_preargs = copy.copy(extra_preargs or [])
|
|
||||||
libraries = copy.copy(libraries or [])
|
|
||||||
objects = copy.copy(objects or [])
|
|
||||||
|
|
||||||
# Additional libraries
|
|
||||||
libraries.extend(self.dll_libraries)
|
|
||||||
|
|
||||||
# handle export symbols by creating a def-file
|
|
||||||
# with executables this only works with gcc/ld as linker
|
|
||||||
if ((export_symbols is not None) and
|
|
||||||
(target_desc != self.EXECUTABLE or self.linker_dll == "gcc")):
|
|
||||||
# (The linker doesn't do anything if output is up-to-date.
|
|
||||||
# So it would probably better to check if we really need this,
|
|
||||||
# but for this we had to insert some unchanged parts of
|
|
||||||
# UnixCCompiler, and this is not what we want.)
|
|
||||||
|
|
||||||
# we want to put some files in the same directory as the
|
|
||||||
# object files are, build_temp doesn't help much
|
|
||||||
# where are the object files
|
|
||||||
temp_dir = os.path.dirname(objects[0])
|
|
||||||
# name of dll to give the helper files the same base name
|
|
||||||
(dll_name, dll_extension) = os.path.splitext(
|
|
||||||
os.path.basename(output_filename))
|
|
||||||
|
|
||||||
# generate the filenames for these files
|
|
||||||
def_file = os.path.join(temp_dir, dll_name + ".def")
|
|
||||||
lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a")
|
|
||||||
|
|
||||||
# Generate .def file
|
|
||||||
contents = [
|
|
||||||
"LIBRARY %s" % os.path.basename(output_filename),
|
|
||||||
"EXPORTS"]
|
|
||||||
for sym in export_symbols:
|
|
||||||
contents.append(sym)
|
|
||||||
self.execute(write_file, (def_file, contents),
|
|
||||||
"writing %s" % def_file)
|
|
||||||
|
|
||||||
# next add options for def-file and to creating import libraries
|
|
||||||
|
|
||||||
# dllwrap uses different options than gcc/ld
|
|
||||||
if self.linker_dll == "dllwrap":
|
|
||||||
extra_preargs.extend(["--output-lib", lib_file])
|
|
||||||
# for dllwrap we have to use a special option
|
|
||||||
extra_preargs.extend(["--def", def_file])
|
|
||||||
# we use gcc/ld here and can be sure ld is >= 2.9.10
|
|
||||||
else:
|
|
||||||
# doesn't work: bfd_close build\...\libfoo.a: Invalid operation
|
|
||||||
#extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file])
|
|
||||||
# for gcc/ld the def-file is specified as any object files
|
|
||||||
objects.append(def_file)
|
|
||||||
|
|
||||||
#end: if ((export_symbols is not None) and
|
|
||||||
# (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")):
|
|
||||||
|
|
||||||
# who wants symbols and a many times larger output file
|
|
||||||
# should explicitly switch the debug mode on
|
|
||||||
# otherwise we let dllwrap/ld strip the output file
|
|
||||||
# (On my machine: 10KiB < stripped_file < ??100KiB
|
|
||||||
# unstripped_file = stripped_file + XXX KiB
|
|
||||||
# ( XXX=254 for a typical python extension))
|
|
||||||
if not debug:
|
|
||||||
extra_preargs.append("-s")
|
|
||||||
|
|
||||||
UnixCCompiler.link(self, target_desc, objects, output_filename,
|
|
||||||
output_dir, libraries, library_dirs,
|
|
||||||
runtime_library_dirs,
|
|
||||||
None, # export_symbols, we do this in our def-file
|
|
||||||
debug, extra_preargs, extra_postargs, build_temp,
|
|
||||||
target_lang)
|
|
||||||
|
|
||||||
# -- Miscellaneous methods -----------------------------------------
|
|
||||||
|
|
||||||
def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
|
|
||||||
"""Adds supports for rc and res files."""
|
|
||||||
if output_dir is None:
|
|
||||||
output_dir = ''
|
|
||||||
obj_names = []
|
|
||||||
for src_name in source_filenames:
|
|
||||||
# use normcase to make sure '.rc' is really '.rc' and not '.RC'
|
|
||||||
base, ext = os.path.splitext(os.path.normcase(src_name))
|
|
||||||
if ext not in (self.src_extensions + ['.rc','.res']):
|
|
||||||
raise UnknownFileError("unknown file type '%s' (from '%s')" % \
|
|
||||||
(ext, src_name))
|
|
||||||
if strip_dir:
|
|
||||||
base = os.path.basename (base)
|
|
||||||
if ext in ('.res', '.rc'):
|
|
||||||
# these need to be compiled to object files
|
|
||||||
obj_names.append (os.path.join(output_dir,
|
|
||||||
base + ext + self.obj_extension))
|
|
||||||
else:
|
|
||||||
obj_names.append (os.path.join(output_dir,
|
|
||||||
base + self.obj_extension))
|
|
||||||
return obj_names
|
|
||||||
|
|
||||||
# the same as cygwin plus some additional parameters
|
|
||||||
class Mingw32CCompiler(CygwinCCompiler):
|
|
||||||
""" Handles the Mingw32 port of the GNU C compiler to Windows.
|
|
||||||
"""
|
|
||||||
compiler_type = 'mingw32'
|
|
||||||
|
|
||||||
def __init__(self, verbose=0, dry_run=0, force=0):
|
|
||||||
|
|
||||||
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
|
|
||||||
|
|
||||||
# ld_version >= "2.13" support -shared so use it instead of
|
|
||||||
# -mdll -static
|
|
||||||
if ('gcc' in self.cc and self.ld_version < "2.13"):
|
|
||||||
shared_option = "-mdll -static"
|
|
||||||
else:
|
|
||||||
shared_option = "-shared"
|
|
||||||
|
|
||||||
# A real mingw32 doesn't need to specify a different entry point,
|
|
||||||
# but cygwin 2.91.57 in no-cygwin-mode needs it.
|
|
||||||
if ('gcc' in self.cc and self.gcc_version <= "2.91.57"):
|
|
||||||
entry_point = '--entry _DllMain@12'
|
|
||||||
else:
|
|
||||||
entry_point = ''
|
|
||||||
|
|
||||||
if is_cygwincc(self.cc):
|
|
||||||
raise CCompilerError(
|
|
||||||
'Cygwin gcc cannot be used with --compiler=mingw32')
|
|
||||||
|
|
||||||
self.set_executables(compiler='%s -O -Wall' % self.cc,
|
|
||||||
compiler_so='%s -mdll -O -Wall' % self.cc,
|
|
||||||
compiler_cxx='%s -O -Wall' % self.cxx,
|
|
||||||
linker_exe='%s' % self.cc,
|
|
||||||
linker_so='%s %s %s'
|
|
||||||
% (self.linker_dll, shared_option,
|
|
||||||
entry_point))
|
|
||||||
# Maybe we should also append -mthreads, but then the finished
|
|
||||||
# dlls need another dll (mingwm10.dll see Mingw32 docs)
|
|
||||||
# (-mthreads: Support thread-safe exception handling on `Mingw32')
|
|
||||||
|
|
||||||
# no additional libraries needed
|
|
||||||
self.dll_libraries=[]
|
|
||||||
|
|
||||||
# Include the appropriate MSVC runtime library if Python was built
|
|
||||||
# with MSVC 7.0 or later.
|
|
||||||
self.dll_libraries = get_msvcr()
|
|
||||||
|
|
||||||
# Because these compilers aren't configured in Python's pyconfig.h file by
|
|
||||||
# default, we should at least warn the user if he is using an unmodified
|
|
||||||
# version.
|
|
||||||
|
|
||||||
CONFIG_H_OK = "ok"
|
|
||||||
CONFIG_H_NOTOK = "not ok"
|
|
||||||
CONFIG_H_UNCERTAIN = "uncertain"
|
|
||||||
|
|
||||||
def check_config_h():
|
|
||||||
"""Check if the current Python installation appears amenable to building
|
|
||||||
extensions with GCC.
|
|
||||||
|
|
||||||
Returns a tuple (status, details), where 'status' is one of the following
|
|
||||||
constants:
|
|
||||||
|
|
||||||
- CONFIG_H_OK: all is well, go ahead and compile
|
|
||||||
- CONFIG_H_NOTOK: doesn't look good
|
|
||||||
- CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h
|
|
||||||
|
|
||||||
'details' is a human-readable string explaining the situation.
|
|
||||||
|
|
||||||
Note there are two ways to conclude "OK": either 'sys.version' contains
|
|
||||||
the string "GCC" (implying that this Python was built with GCC), or the
|
|
||||||
installed "pyconfig.h" contains the string "__GNUC__".
|
|
||||||
"""
|
|
||||||
|
|
||||||
# XXX since this function also checks sys.version, it's not strictly a
|
|
||||||
# "pyconfig.h" check -- should probably be renamed...
|
|
||||||
|
|
||||||
from distutils import sysconfig
|
|
||||||
|
|
||||||
# if sys.version contains GCC then python was compiled with GCC, and the
|
|
||||||
# pyconfig.h file should be OK
|
|
||||||
if "GCC" in sys.version:
|
|
||||||
return CONFIG_H_OK, "sys.version mentions 'GCC'"
|
|
||||||
|
|
||||||
# Clang would also work
|
|
||||||
if "Clang" in sys.version:
|
|
||||||
return CONFIG_H_OK, "sys.version mentions 'Clang'"
|
|
||||||
|
|
||||||
# let's see if __GNUC__ is mentioned in python.h
|
|
||||||
fn = sysconfig.get_config_h_filename()
|
|
||||||
try:
|
|
||||||
config_h = open(fn)
|
|
||||||
try:
|
|
||||||
if "__GNUC__" in config_h.read():
|
|
||||||
return CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn
|
|
||||||
else:
|
|
||||||
return CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn
|
|
||||||
finally:
|
|
||||||
config_h.close()
|
|
||||||
except OSError as exc:
|
|
||||||
return (CONFIG_H_UNCERTAIN,
|
|
||||||
"couldn't read '%s': %s" % (fn, exc.strerror))
|
|
||||||
|
|
||||||
RE_VERSION = re.compile(br'(\d+\.\d+(\.\d+)*)')
|
|
||||||
|
|
||||||
def _find_exe_version(cmd):
|
|
||||||
"""Find the version of an executable by running `cmd` in the shell.
|
|
||||||
|
|
||||||
If the command is not found, or the output does not match
|
|
||||||
`RE_VERSION`, returns None.
|
|
||||||
"""
|
|
||||||
executable = cmd.split()[0]
|
|
||||||
if find_executable(executable) is None:
|
|
||||||
return None
|
|
||||||
out = Popen(cmd, shell=True, stdout=PIPE).stdout
|
|
||||||
try:
|
|
||||||
out_string = out.read()
|
|
||||||
finally:
|
|
||||||
out.close()
|
|
||||||
result = RE_VERSION.search(out_string)
|
|
||||||
if result is None:
|
|
||||||
return None
|
|
||||||
# LooseVersion works with strings; decode
|
|
||||||
ver_str = result.group(1).decode()
|
|
||||||
with distutils.version.suppress_known_deprecation():
|
|
||||||
return LooseVersion(ver_str)
|
|
||||||
|
|
||||||
def get_versions():
|
|
||||||
""" Try to find out the versions of gcc, ld and dllwrap.
|
|
||||||
|
|
||||||
If not possible it returns None for it.
|
|
||||||
"""
|
|
||||||
commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version']
|
|
||||||
return tuple([_find_exe_version(cmd) for cmd in commands])
|
|
||||||
|
|
||||||
def is_cygwincc(cc):
|
|
||||||
'''Try to determine if the compiler that would be used is from cygwin.'''
|
|
||||||
out_string = check_output([cc, '-dumpmachine'])
|
|
||||||
return out_string.strip().endswith(b'cygwin')
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue