Skip to content
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

Optionally validate entry point at build time #521

Merged
merged 37 commits into from
Jul 23, 2018
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6a45d41
initial
wisechengyi Jul 7, 2018
df5e696
can verify file existence
wisechengyi Jul 8, 2018
1e5c2c4
can verify both
wisechengyi Jul 8, 2018
67e7010
works fine
wisechengyi Jul 9, 2018
bf58ade
cmt
wisechengyi Jul 9, 2018
fec3647
rev init
wisechengyi Jul 9, 2018
89eaf6d
nit
wisechengyi Jul 9, 2018
b07e726
use import to check entry point validity
wisechengyi Jul 18, 2018
1756370
fmt
wisechengyi Jul 18, 2018
f9136a9
option
wisechengyi Jul 18, 2018
883d13a
flag works
wisechengyi Jul 18, 2018
ca5fa38
reorder sig
wisechengyi Jul 18, 2018
a2cd12a
diff module and method
wisechengyi Jul 18, 2018
738dd48
fmt
wisechengyi Jul 18, 2018
1e23269
add tests
wisechengyi Jul 18, 2018
394bb7f
fix comment
wisechengyi Jul 18, 2018
973cdf1
refactor tests
wisechengyi Jul 18, 2018
c255c28
minor fix
wisechengyi Jul 18, 2018
5fd3791
pr
wisechengyi Jul 18, 2018
3af0997
style
wisechengyi Jul 18, 2018
b49056a
back
wisechengyi Jul 18, 2018
c04c2b1
move into pex
wisechengyi Jul 18, 2018
a2403f3
minor fix
wisechengyi Jul 18, 2018
b60cc7b
fmt
wisechengyi Jul 20, 2018
4d07117
minor
wisechengyi Jul 20, 2018
70701bb
execute a file containing import
wisechengyi Jul 20, 2018
6ef2990
remove dup code
wisechengyi Jul 20, 2018
94de45c
privatize do_entry_point_verification
wisechengyi Jul 20, 2018
08bb959
fmt
wisechengyi Jul 20, 2018
469ea27
test_pex.py starts to work
wisechengyi Jul 21, 2018
7f1c478
pex tests
wisechengyi Jul 21, 2018
f60595a
integration tests
wisechengyi Jul 21, 2018
ac0bf83
style
wisechengyi Jul 21, 2018
23eb42e
encoding
wisechengyi Jul 21, 2018
9903ec0
further fix encoding
wisechengyi Jul 21, 2018
8ccf87c
skip pypy
wisechengyi Jul 21, 2018
9ec096a
for pr
wisechengyi Jul 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor
wisechengyi committed Jul 20, 2018
commit 4d071171800759a8d0003b21b60cd364a1f1f06d
2 changes: 1 addition & 1 deletion bin.py
Original file line number Diff line number Diff line change
@@ -392,7 +392,7 @@ def configure_clp_pex_entry_points(parser):
default=False,
action='store_true',
help='Validate the entry point by importing it in separate process. Warning: this could have '
'side effect. For example, entry point `a.b.c:m` will translate to '
'side effects. For example, entry point `a.b.c:m` will translate to '
'`from a.b.c import m` during validation. [Default: %default]')

parser.add_option_group(group)
4 changes: 2 additions & 2 deletions pex/pex.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
from .orderedset import OrderedSet
from .pex_info import PexInfo
from .tracer import TRACER
from .util import iter_pth_paths, merge_split, named_temporary_file
from .util import iter_pth_paths, merge_split
from .variables import ENV


@@ -544,7 +544,7 @@ class InvalidEntryPoint(Exception):
ep_method = ep_split[1]
import_statement = 'from {} import {}'.format(ep_module, ep_method)
else:
raise InvalidEntryPoint("Fail to parse: `{}`".format(entry_point))
raise InvalidEntryPoint("Failed to parse: `{}`".format(entry_point))

retcode = self.run(['-c', import_statement], env={'PEX_INTERPRETER': '1'})
if retcode != 0:
3 changes: 1 addition & 2 deletions tests/test_pex_builder.py
Original file line number Diff line number Diff line change
@@ -182,7 +182,6 @@ def build_and_check(path, copy):
build_and_check(td3, True)



@contextmanager
def _add_test_hello_to_pex():
with temporary_dir() as td:
@@ -233,4 +232,4 @@ def _add_test_hello_to_pex():
#
# # Expect InvalidEntryPoint due to invalid entry point module
# with pytest.raises(PEXBuilder.InvalidEntryPoint):
# pex_builder.build(target, verify_entry_point=True)
# pex_builder.build(target, verify_entry_point=True)