Strip .git from _git_repo variables

Several GitLab users have said that they have to include the .git in
in the URL of their _git_repo variable overrides and then subsequently
override the package name using _git_package_name.  Failing to do this
means the repo is cloned with .git in the directory name.

This change updates lookup/py_pkgs.py to strip a trailing newline,
a trailing .git, or a trailing .git/ from _git_repo variables.

Change-Id: I174ab1398be8e180c346ea29fa71238cc3698c45
This commit is contained in:
Matt Thompson 2016-03-02 15:28:53 +00:00
parent 8c3bbb8c77
commit b0a64302c4
1 changed files with 2 additions and 1 deletions

View File

@ -387,8 +387,9 @@ class DependencyFileProcessor(object):
# get the repo name definition
name = git_data['name'] = loaded_yaml.get(name_var)
if not name:
# NOTE: strip off trailing /, .git, or .git/
name = git_data['name'] = os.path.basename(
git_data['repo'].rstrip('/')
re.sub(r'(\/$|\.git(\/)?$)', '', git_data['repo'])
)
git_data['egg_name'] = name.replace('-', '_')