Skip to content

Commit

Permalink
Allow missing .py files if .pyc is present
Browse files Browse the repository at this point in the history
  • Loading branch information
tucked committed Mar 11, 2020
1 parent 93cf9ed commit b585058
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/changelog/1714.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow missing ``.py`` files if a compiled ``.pyc`` version is available - by :user:`tucked`.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ def sources(cls, interpreter):
# install files needed to run site.py
for req in cls.modules():
stdlib_path = interpreter.stdlib_path("{}.py".format(req))
yield PathRefToDest(stdlib_path, dest=cls.to_stdlib)
comp = stdlib_path.parent / "{}.pyc".format(req)
if comp.exists():
comp_exists = comp.exists()
if stdlib_path.exists() or not comp_exists:
yield PathRefToDest(stdlib_path, dest=cls.to_stdlib)
if comp_exists:
yield PathRefToDest(comp, dest=cls.to_stdlib)

def to_stdlib(self, src):
Expand Down

0 comments on commit b585058

Please sign in to comment.