Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] pigar doesn't check if the dev dir is part of a bigger git repository. #60

Closed
OlivierDehaene opened this issue Dec 4, 2019 · 1 comment · Fixed by #124
Closed
Milestone

Comments

@OlivierDehaene
Copy link

OlivierDehaene commented Dec 4, 2019

In reqs.py:_search_path

def _search_path(path):
    mapping = dict()

    for file in os.listdir(path):
        # Install from PYPI.
        if fnmatch.fnmatch(file, '*-info'):
            ...

        # Install from local and available in GitHub.
        elif fnmatch.fnmatch(file, '*-link'):
            ...

            # Check .git dir.
            git_path = os.path.join(dev_dir, '.git')
            ...
            
    return mapping

The git directory checking is sufficient for the best case scenario where the package's code is next to the .git directory. However if your package is part of a bigger git repository, the checking fails because git_path doesn't exist.

One of the potential way of solving this issue would be to write a similar logic to what pip does, a subprocess call to git rev-parse --git-dir. See: this line.

If adding pip to the dependencies is not an issue, using pip._internal.vcs.git.Git directly for the full git logic could be another option.

@damnever
Copy link
Owner

damnever commented Dec 6, 2019

Thanks for reporting this!

You are welcome to submit a PR to address the issue.

@damnever damnever added this to the v2 milestone Nov 12, 2022
@damnever damnever linked a pull request Nov 26, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants