python-pathspec icon indicating copy to clipboard operation
python-pathspec copied to clipboard

Symlink pathspec_meta.py breaks Windows

Open jayvdb opened this issue 2 years ago • 0 comments

setup.cfg refers to https://github.com/cpburnz/python-path-specification/blob/master/pathspec_meta.py with

version: attr: pathspec_meta.__version__

On a git checkout on Windows, unless git config core.symlinks was enabled explicitly, the following occurs when trying to install the package.

Traceback (most recent call last):
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\config.py", line 40, in __getattr__
    for statement in self.module.body
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\config.py", line 391, in _parse_attr
    return getattr(StaticModule(module_name), attr_name)
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\config.py", line 47, in __getattr__
    "{self.name} has no attribute {attr}".format(**locals()))
AttributeError: pathspec_meta has no attribute __version__

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    setup()
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\distutils\core.py", line 121, in setup
    dist.parse_config_files()
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\dist.py", line 690, in parse_config_files
    ignore_option_errors=ignore_option_errors)
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\config.py", line 161, in parse_configuration
    meta.parse()
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\config.py", line 467, in parse
    section_parser_method(section_options)
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\config.py", line 440, in parse_section
    self[name] = value
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\config.py", line 224, in __setitem__
    value = parser(value)
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\config.py", line 556, in _parse_version
    version = self._parse_attr(value, self.package_dir)
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\setuptools\config.py", line 394, in _parse_attr
    module = importlib.import_module(module_name)
  File "C:\Users\vandjohn\Downloads\WPy64-3771\python-3.7.7.amd64\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\vandjohn\gh\python-path-specification\pathspec_meta.py", line 1, in <module>
    pathspec/_meta.py
NameError: name 'pathspec' is not defined

Using the following in setup.cfg works for me, but I suspect there was some problem with this (possibly a setuptools issue?) which the symlink was intended to workaround.

version: attr: pathspec._meta.__version__

jayvdb avatar Oct 29 '21 09:10 jayvdb