from pathlib import Path
PACKAGE_REGEX = re.compile(r"^(?:--.+\s)?([-_\.\w\d]+).*==.+$")
+GIT_REPO_REGEX = re.compile(r"^(git\+https:\/\/[-_\.\w\d\/]+[@-_\.\w\d\/]*)$")
def gather_core_requirements() -> list[str]:
for req_str in core_reqs + extra_reqs:
if match := PACKAGE_REGEX.search(req_str):
package_name = match.group(1).lower().replace("_", "-")
- if package_name in final_requirements:
- # duplicate package without version is safe to ignore
- print("ignoring %s" % package_name)
- continue
+ elif match := GIT_REPO_REGEX.search(req_str):
+ package_name = match.group(1)
+ elif package_name in final_requirements:
+ # duplicate package without version is safe to ignore
+ continue
else:
print("Found requirement without version specifier: %s" % req_str)
package_name = req_str
existing = final_requirements.get(package_name)
if existing:
- print(f"WARNING: ignore duplicate package: {package_name} - existing: {existing}")
+ print("WARNING: ignore duplicate package: %s - existing: %s" % package_name, existing)
continue
final_requirements[package_name] = req_str