forked from pex-tool/pex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
--scie-name-style platform-parent-dir
. (pex-tool#2526)
This required bumping our `science` floor to the just released 0.8.0 which adds support for explicitly requesting `--no-use-platform-suffix`. Fixes pex-tool#2516
- Loading branch information
Showing
6 changed files
with
146 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2015 Pex project contributors. | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
__version__ = "2.18.0" | ||
__version__ = "2.18.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Copyright 2024 Pex project contributors. | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import absolute_import | ||
|
||
import glob | ||
import os.path | ||
import subprocess | ||
from textwrap import dedent | ||
|
||
from pex.common import safe_open | ||
from pex.scie import SciePlatform | ||
from pex.typing import TYPE_CHECKING | ||
from testing import make_env, run_pex_command | ||
|
||
if TYPE_CHECKING: | ||
from typing import Any | ||
|
||
import colors # vendor:skip | ||
else: | ||
from pex.third_party import colors | ||
|
||
|
||
def test_discussion_2516_op(tmpdir): | ||
# type: (Any) -> None | ||
|
||
requirements = os.path.join(str(tmpdir), "requirements-pex.txt") | ||
with open(requirements, "w") as fp: | ||
fp.write( | ||
dedent( | ||
"""\ | ||
ansicolors | ||
cowsay | ||
""" | ||
) | ||
) | ||
|
||
with safe_open(os.path.join(str(tmpdir), "src", "ardia", "cli", "ardia.py"), "w") as fp: | ||
fp.write( | ||
dedent( | ||
"""\ | ||
import sys | ||
import colors | ||
import cowsay | ||
def main() -> None: | ||
message = " ".join(sys.argv[1:]) | ||
cowsay.tux(colors.cyan(message)) | ||
""" | ||
) | ||
) | ||
|
||
out_dir = os.path.join(str(tmpdir), "build", "pex") | ||
for abbreviated_platform in ( | ||
"linux_aarch64-cp-3.11.9-cp311", | ||
"linux_x86_64-cp-3.11.9-cp311", | ||
"macosx_11_0_arm64-cp-3.11.9-cp311", | ||
"macosx_11_0_x86_64-cp-3.11.9-cp311", | ||
): | ||
run_pex_command( | ||
args=[ | ||
"--no-build", | ||
"--requirement", | ||
"requirements-pex.txt", | ||
"--entry-point", | ||
"ardia.cli.ardia:main", | ||
"--package", | ||
"ardia@src", | ||
"--output-file", | ||
os.path.join(out_dir, "ardia"), | ||
"--scie", | ||
"eager", | ||
"--scie-only", | ||
"--scie-name-style", | ||
"platform-parent-dir", | ||
"--platform", | ||
abbreviated_platform, | ||
], | ||
cwd=str(tmpdir), | ||
).assert_success() | ||
|
||
assert sorted( | ||
[ | ||
"build/pex/linux-aarch64/ardia", | ||
"build/pex/linux-x86_64/ardia", | ||
"build/pex/macos-aarch64/ardia", | ||
"build/pex/macos-x86_64/ardia", | ||
] | ||
) == sorted( | ||
os.path.relpath(os.path.join(root, f), str(tmpdir)) | ||
for root, _, files in os.walk(out_dir) | ||
for f in files | ||
) | ||
assert not glob.glob( | ||
os.path.join(str(tmpdir), "ardia*") | ||
), "We expected no PEX or scie leaked in the CWD." | ||
|
||
native_scie = os.path.join(out_dir, SciePlatform.CURRENT.value, "ardia") | ||
output = subprocess.check_output( | ||
args=[native_scie, "Tux", "says", "Moo?"], env=make_env(PATH=None) | ||
).decode("utf-8") | ||
assert "| {msg} |".format(msg=colors.cyan("Tux says Moo?")) in output, output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters