Skip to content

Commit

Permalink
Fix tox -e gen-scie-platform machinery.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Dec 13, 2024
1 parent 195d8fd commit 21c6e61
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 3 additions & 1 deletion package/package.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ pex-extras = [
"management",
]

# This customization gets us a lockable psutil wheel for armv7l.
extra-lock-args = ["--index", "https://www.piwheels.org/simple"]

[scie.platforms.linux-aarch64]

[scie.platforms.linux-armv7l]
# This customization gets us a lockable psutil wheel.
python-version = "3.11.11"
extra-lock-args = ["--index", "https://www.piwheels.org/simple"]
# TODO(John Sirois): Remove once the complete platform file is generated.
required = false

Expand Down
14 changes: 6 additions & 8 deletions package/scie_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ def load(
name=name,
pbs_release=platform_data.get("pbs-release", default_pbs_release),
python_version=platform_data.get("python-version", default_python_version),
extra_lock_args=tuple(platform_data.get("extra-lock-args", ())),
required=platform_data.get("required", True),
)

name: str
pbs_release: str
python_version: str
extra_lock_args: tuple[str, ...] = ()
required: bool = True


Expand All @@ -58,22 +56,23 @@ def load(
scie_config = toml.loads(data.decode())["scie"]
default_pbs_release = pbs_release or scie_config["pbs-release"]
default_python_version = python_version or scie_config["python-version"]

return cls(
pex_extras=tuple(scie_config["pex-extras"]),
platforms=tuple(
PlatformConfig.load(
name=platform_name,
platform_data=platform_data,
default_pbs_release=default_pbs_release,
default_python_version=default_python_version,
)
for platform_name, platform_data in scie_config.get("platforms", {}).items()
for platform_name, platform_data in scie_config["platforms"].items()
),
pex_extras=tuple(scie_config.get("pex-extras", ())),
extra_lock_args=tuple(scie_config.get("extra-lock-args", ())),
)

pex_extras: tuple[str, ...]
platforms: tuple[PlatformConfig, ...]
pex_extras: tuple[str, ...] = ()
extra_lock_args: tuple[str, ...] = ()

def current_platform(self) -> PlatformConfig:
system = platform.system().lower()
Expand Down Expand Up @@ -114,8 +113,6 @@ def encode(self) -> str:
data["pbs-release"] = platform_config.pbs_release
if platform_config.python_version != default_python_version:
data["python-version"] = platform_config.python_version
if platform_config.extra_lock_args:
data["extra-lock-args"] = platform_config.extra_lock_args
if not platform_config.required:
data["required"] = False
platforms[platform_config.name] = data
Expand All @@ -126,6 +123,7 @@ def encode(self) -> str:
"pbs-release": default_pbs_release,
"python-version": default_python_version,
"pex-extras": self.pex_extras,
"extra-lock-args": self.extra_lock_args,
"platforms": platforms,
}
).encode()
Expand Down
3 changes: 2 additions & 1 deletion scripts/gen-scie-platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ def create_lock(
"2",
"--lock",
str(lock_file),
],
]
+ list(scie_config.extra_lock_args),
check=True,
)

Expand Down

0 comments on commit 21c6e61

Please sign in to comment.