Skip to content

Exception handling doesn't work if the package isn't installed #8

@chrko

Description

@chrko

Hi,

there is an error in the exception handling if the package isn't installed:

version = get_distribution(dist.get_name()).version

I have a setup where I don't transfer the git history to a remote machine, but I need to run the python code itself there.
A simple pip install -e . is failing with

(env)pi@pi:~/christian-dev/proj/src$ pip install -e .
Obtaining file:///home/pi/christian-dev/proj/src
    Complete output from command python setup.py egg_info:
    fatal: Not a git repository (or any of the parent directories): .git
    Traceback (most recent call last):
      File "/home/pi/christian-dev/env/lib/python3.4/site-packages/setuptools_git_version.py", line 11, in validate_version_format
        version = check_output(command.split()).decode('utf-8').strip()
      File "/usr/lib/python3.4/subprocess.py", line 620, in check_output
        raise CalledProcessError(retcode, process.args, output=output)
    subprocess.CalledProcessError: Command '['git', 'describe', '--tags', '--long', '--dirty']' returned non-zero exit status 128

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/pi/christian-dev/proj/src/setup.py", line 14, in <module>
        'pytest'
      File "/usr/lib/python3.4/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/pi/christian-dev/env/lib/python3.4/site-packages/setuptools/dist.py", line 320, in __init__
        _Distribution.__init__(self, attrs)
      File "/usr/lib/python3.4/distutils/dist.py", line 280, in __init__
        self.finalize_options()
      File "/home/pi/christian-dev/env/lib/python3.4/site-packages/setuptools/dist.py", line 387, in finalize_options
        ep.load()(self, ep.name, value)
      File "/home/pi/christian-dev/env/lib/python3.4/site-packages/setuptools_git_version.py", line 13, in validate_version_format
        version = get_distribution(dist.get_name()).version
      File "/home/pi/christian-dev/env/lib/python3.4/site-packages/pkg_resources/__init__.py", line 552, in get_distribution
        dist = get_provider(dist)
      File "/home/pi/christian-dev/env/lib/python3.4/site-packages/pkg_resources/__init__.py", line 426, in get_provider
        return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
      File "/home/pi/christian-dev/env/lib/python3.4/site-packages/pkg_resources/__init__.py", line 968, in require
        needed = self.resolve(parse_requirements(requirements))
      File "/home/pi/christian-dev/env/lib/python3.4/site-packages/pkg_resources/__init__.py", line 854, in resolve
        raise DistributionNotFound(req, requirers)
    pkg_resources.DistributionNotFound: The 'proj' distribution was not found and is required by the application

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /home/pi/christian-dev/proj/src/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions