Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Monkeypatch pkg_resources to always use _markerlib#285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gsnedders merged 1 commit intohtml5lib:masterfromjayvdb:envmarker-monkeypatching
Jul 26, 2016
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletionsrequirements-install.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,9 +5,6 @@ if [[ $USE_OPTIONAL != "true" && $USE_OPTIONAL != "false" ]]; then
exit 1
fi

# Make sure we're running setuptools >= 18.5
pip install -U pip setuptools>=18.5

pip install -U -r requirements-test.txt

if [[ $USE_OPTIONAL == "true" ]]; then
Expand Down
1 change: 0 additions & 1 deletionrequirements-test.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,4 +4,3 @@ flake8
pytest
pytest-expect>=1.1,<2.0
mock
ordereddict ; python_version < '2.7'
1 change: 0 additions & 1 deletionrequirements.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
six
webencodings
ordereddict ; python_version < '2.7'
setuptools>=18.5
53 changes: 48 additions & 5 deletionssetup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,10 +8,54 @@
from setuptools import setup, find_packages, __version__ as setuptools_version
from pkg_resources import parse_version

if parse_version(setuptools_version) < parse_version("18.5"):
print("html5lib requires setuptools version 18.5 or above; "
"please upgrade before installing (you have %s)" % setuptools_version)
sys.exit(1)
import pkg_resources

try:
import _markerlib.markers
except ImportError:
_markerlib = None


# _markerlib.default_environment() obtains its data from _VARS
# and wraps it in another dict, but _markerlib_evaluate writes
# to the dict while it is iterating the keys, causing an error
# on Python 3 only.
# Replace _markerlib.default_environment to return a custom dict
# that has all the necessary markers, and ignores any writes.

class Python3MarkerDict(dict):

def __setitem__(self, key, value):
pass

def pop(self, i=-1):
return self[i]


if _markerlib and sys.version_info[0] == 3:
env = _markerlib.markers._VARS
for key in list(env.keys()):
new_key = key.replace('.', '_')
if new_key != key:
env[new_key] = env[key]

_markerlib.markers._VARS = Python3MarkerDict(env)

def default_environment():
return _markerlib.markers._VARS

_markerlib.default_environment = default_environment

# Avoid the very buggy pkg_resources.parser, which doesnt consistently
# recognise the markers needed by this setup.py
# Change this to setuptools 20.10.0 to support all markers.
if pkg_resources:
if parse_version(setuptools_version) < parse_version('18.5'):
MarkerEvaluation = pkg_resources.MarkerEvaluation

del pkg_resources.parser
pkg_resources.evaluate_marker = MarkerEvaluation._markerlib_evaluate
MarkerEvaluation.evaluate_marker = MarkerEvaluation._markerlib_evaluate

classifiers = [
'Development Status :: 5 - Production/Stable',
Expand DownExpand Up@@ -60,7 +104,6 @@
install_requires=[
'six',
'webencodings',
'setuptools>=18.5'
],
extras_require={
# A empty extra that only has a conditional marker will be
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp