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

Dev #2944

Closed
wants to merge 3 commits into from
Closed

Dev #2944

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
def map_dependencies(info):
if type(info) is dict:

if "version" in info:

Check warning on line 60 in augur/tasks/git/dependency_libyear_tasks/libyear_util/pypi_parser.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return) Raw Output: augur/tasks/git/dependency_libyear_tasks/libyear_util/pypi_parser.py:60:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
return info['version']
elif 'git' in info:
return info['git']+'#'+info['ref']
Expand Down Expand Up @@ -140,12 +140,12 @@
group = 'runtime'
for package in manifest['package']:
req = None
if package['category'] == 'main':
if package.get('category') == 'main':
group = 'runtime'
if package['category'] == 'dev':
if package.get('category') == 'dev':
group = 'develop'
if 'version' in package:
req = package['version']
req = package.get('version')
elif 'git' in package:
req = package['git']+'#'+package['ref']
Dict = {'name': package['name'], 'requirement': req, 'type': group, 'package': 'PYPI'}
Expand All @@ -163,7 +163,7 @@
#dependencies = contents['dependencies']
dependencies = contents.get('dependencies', [])

if not dependencies:

Check warning on line 166 in augur/tasks/git/dependency_libyear_tasks/libyear_util/pypi_parser.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return) Raw Output: augur/tasks/git/dependency_libyear_tasks/libyear_util/pypi_parser.py:166:4: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
print("No dependencies found.")
return []
else:
Expand Down
56 changes: 29 additions & 27 deletions augur/tasks/git/dependency_libyear_tasks/libyear_util/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,54 +32,56 @@ def get_parsed_deps(path,logger):

deps_file = None
dependency_list = list()

for f in file_list:
deps_file = find(f, path)
if not deps_file:

if not deps_file or not f:
continue
file_handle= open(deps_file)

if f == 'Requirement.txt':
dependency_list = parse_requirement_txt(file_handle)
short_file_name = os.path.split(deps_file)[-1]

if short_file_name == 'Requirement.txt':
dependency_list.extend(parse_requirement_txt(file_handle))

elif f == 'requirements.txt':
dependency_list = parse_requirement_txt(file_handle)
if short_file_name == 'requirements.txt':
dependency_list.extend(parse_requirement_txt(file_handle))

elif f == 'setup.py':
dependency_list = parse_setup_py(file_handle)
if short_file_name == 'setup.py':
dependency_list.extend(parse_setup_py(file_handle))

elif f == 'Pipfile':
dependency_list = parse_pipfile(file_handle)
if short_file_name == 'Pipfile':
dependency_list.extend(parse_pipfile(file_handle))

elif f == 'Pipfile.lock':
dependency_list = parse_pipfile_lock(file_handle)
if short_file_name == 'Pipfile.lock':
dependency_list.extend(parse_pipfile_lock(file_handle))

elif f == 'pyproject.toml':
dependency_list = parse_poetry(file_handle)
if short_file_name == 'pyproject.toml':
dependency_list.extend(parse_poetry(file_handle))

elif f == 'poetry.lock':
dependency_list = parse_poetry_lock(file_handle)
if short_file_name == 'poetry.lock':
dependency_list.extend(parse_poetry_lock(file_handle))

elif f == 'environment.yml':
dependency_list = parse_conda(file_handle)
if short_file_name == 'environment.yml':
dependency_list.extend(parse_conda(file_handle))

elif f == 'environment.yaml':
dependency_list = parse_conda(file_handle)
if short_file_name == 'environment.yaml':
dependency_list.extend(parse_conda(file_handle))

elif f == 'environment.yml.lock':
dependency_list = parse_conda(file_handle)
if f == 'environment.yml.lock':
dependency_list.extend(parse_conda(file_handle))

elif f == 'environment.yaml.lock':
dependency_list = parse_conda(file_handle)
if short_file_name == 'environment.yaml.lock':
dependency_list.extend(parse_conda(file_handle))

elif f == 'package.json':
if short_file_name == 'package.json':
try:
dependency_list = parse_package_json(file_handle)
dependency_list.extend(parse_package_json(file_handle))
except KeyError as e:
logger.error(f"package.json for repo at path {path} is missing required key: {e}\n Skipping file...")


return dependency_list
return dependency_list


def get_libyear(current_version, current_release_date, latest_version, latest_release_date):
Expand Down
Loading