-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
PEX zips now contain directory entries. #1022
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1130,6 +1130,34 @@ def test_pex_source_bundling(): | |
assert stdout == b"hello\n" | ||
|
||
|
||
def test_pex_source_bundling_pep420(): | ||
with temporary_dir() as output_dir: | ||
with temporary_dir() as input_dir: | ||
with safe_open(os.path.join(input_dir, "a/b/c.py"), "w") as fh: | ||
fh.write("GREETING = 'hello'") | ||
|
||
with open(os.path.join(input_dir, "exe.py"), "w") as fh: | ||
fh.write( | ||
dedent( | ||
""" | ||
from a.b.c import GREETING | ||
|
||
print(GREETING) | ||
""" | ||
) | ||
) | ||
|
||
pex_path = os.path.join(output_dir, "pex1.pex") | ||
py36 = ensure_python_interpreter(PY36) | ||
res = run_pex_command(["-o", pex_path, "-D", input_dir, "-e", "exe"], python=py36) | ||
res.assert_success() | ||
|
||
stdout, rc = run_simple_pex(pex_path, interpreter=PythonInterpreter.from_binary(py36)) | ||
|
||
assert rc == 0 | ||
assert stdout == b"hello\n" | ||
|
||
|
||
def test_pex_resource_bundling(): | ||
with temporary_dir() as output_dir: | ||
with temporary_dir() as input_dir, temporary_dir() as resources_input_dir: | ||
|
@@ -1640,11 +1668,11 @@ def create_pex(path, seed): | |
zf1.extractall(path=unzipped1) | ||
zf2.extractall(path=unzipped2) | ||
for member1, member2 in zip(sorted(zf1.namelist()), sorted(zf2.namelist())): | ||
assert filecmp.cmp( | ||
os.path.join(unzipped1, member1), | ||
os.path.join(unzipped2, member2), | ||
shallow=False, | ||
) | ||
member1_path = os.path.join(unzipped1, member1) | ||
if os.path.isdir(member1_path): | ||
continue | ||
Comment on lines
+1672
to
+1673
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason for skipping? Are the directory entries not byte-for-byte identical? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's because |
||
member2_path = os.path.join(unzipped2, member2) | ||
assert filecmp.cmp(member1_path, member2_path, shallow=False) | ||
# Then compare the original .pex files. This is the assertion we truly care about. | ||
assert filecmp.cmp(pex1, pex2, shallow=False) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, you can combine these to reduce nesting:
This is fine to keep - only want to make sure you're aware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. I'll stick with the copypasta from the test above for now.