| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,56 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | 7 | from os.path import join, dirname | |
| 8 | 8 | from setuptools import setup, find_packages, __version__ as setuptools_version | |
| 9 | - from pkg_resources import parse_version | ||
| 10 | - | ||
| 11 | - import pkg_resources | ||
| 12 | - | ||
| 13 | - try: | ||
| 14 | - import _markerlib.markers | ||
| 15 | - except ImportError: | ||
| 16 | - _markerlib = None | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - # _markerlib.default_environment() obtains its data from _VARS | ||
| 20 | - # and wraps it in another dict, but _markerlib_evaluate writes | ||
| 21 | - # to the dict while it is iterating the keys, causing an error | ||
| 22 | - # on Python 3 only. | ||
| 23 | - # Replace _markerlib.default_environment to return a custom dict | ||
| 24 | - # that has all the necessary markers, and ignores any writes. | ||
| 25 | - | ||
| 26 | - class Python3MarkerDict(dict): | ||
| 27 | - | ||
| 28 | - def __setitem__(self, key, value): | ||
| 29 | - pass | ||
| 30 | - | ||
| 31 | - def pop(self, i=-1): | ||
| 32 | - return self[i] | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - if _markerlib and sys.version_info[0] == 3: | ||
| 36 | - env = _markerlib.markers._VARS | ||
| 37 | - for key in list(env.keys()): | ||
| 38 | - new_key = key.replace('.', '_') | ||
| 39 | - if new_key != key: | ||
| 40 | - env[new_key] = env[key] | ||
| 41 | - | ||
| 42 | - _markerlib.markers._VARS = Python3MarkerDict(env) | ||
| 43 | - | ||
| 44 | - def default_environment(): | ||
| 45 | - return _markerlib.markers._VARS | ||
| 46 | - | ||
| 47 | - _markerlib.default_environment = default_environment | ||
| 48 | - | ||
| 49 | - # Avoid the very buggy pkg_resources.parser, which doesn't consistently | ||
| 50 | - # recognise the markers needed by this setup.py | ||
| 51 | - # Change this to setuptools 20.10.0 to support all markers. | ||
| 52 | - if pkg_resources: | ||
| 53 | - if parse_version(setuptools_version) < parse_version('18.5'): | ||
| 54 | - MarkerEvaluation = pkg_resources.MarkerEvaluation | ||
| 55 | - | ||
| 56 | - del pkg_resources.parser | ||
| 57 | - pkg_resources.evaluate_marker = MarkerEvaluation._markerlib_evaluate | ||
| 58 | - MarkerEvaluation.evaluate_marker = MarkerEvaluation._markerlib_evaluate | ||
| 59 | 9 | ||
| 60 | 10 | classifiers = [ | |
| 61 | 11 | 'Development Status :: 5 - Production/Stable', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments