Skip to content

Commit

Permalink
chore(installer): Fixed install script dependency parsing (#166)
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Spearman <[email protected]>
  • Loading branch information
evanspearman-a authored Aug 23, 2024
1 parent aab70f1 commit 1aa8475
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
17 changes: 3 additions & 14 deletions scripts/_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,15 @@ def get_project_dict(project_path: Optional[Path] = None) -> dict[str, Any]:

class Dependency:
name: str
operator: Optional[str]
version: Optional[str]
spec: str

def __init__(self, dep: str):
components = dep.split(" ")
self.name = components[0]
if len(components) > 2:
self.operator = components[1]
self.version = components[2]
else:
self.operator = None
self.version = None

def for_pip(self) -> str:
if self.operator is not None and self.version is not None:
return f"{self.name}{self.operator}{self.version}"
return self.name
self.spec = dep

def __repr__(self) -> str:
return self.for_pip()
return self.spec


def get_dependencies(pyproject_dict: dict[str, Any], include_adaptor=True) -> list[Dependency]:
Expand Down
9 changes: 7 additions & 2 deletions scripts/install_dev_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,14 @@ def _resolve_dependencies(local_deps: list[Path]) -> dict[str, str]:
args = [
"pipgrip",
"--json",
*[dep.for_pip() for dep in flattened_dependency_list],
*[dep.spec for dep in flattened_dependency_list],
]
result = subprocess.run(args, check=True, capture_output=True, text=True)
try:
result = subprocess.run(args, check=True, capture_output=True, text=True)
except subprocess.CalledProcessError as e:
print(e.stderr)
print(e.stdout)
raise
return json.loads(result.stdout)


Expand Down

0 comments on commit 1aa8475

Please sign in to comment.