summaryrefslogtreecommitdiff
path: root/Lib/site.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2014-03-30 21:07:25 +0200
committerMartin v. Löwis <martin@v.loewis.de>2014-03-30 21:07:25 +0200
commitc00d39e96aff698a8777120f9537e261c06be0ef (patch)
treecda5f37bb98e783d7006ec064b24b8d8968247ff /Lib/site.py
parent3a4340325b153eab1f1bb1b91882d777fe6bcb21 (diff)
downloadcpython-git-c00d39e96aff698a8777120f9537e261c06be0ef.tar.gz
Issue #16047: Fix module exception list and __file__ handling in freeze.
Patch by Meador Inge.
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 4fb1058a1e..ded653948f 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -364,12 +364,17 @@ def setcopyright():
builtins.credits = _sitebuiltins._Printer("credits", """\
Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
for supporting Python development. See www.python.org for more information.""")
- here = os.path.dirname(os.__file__)
+ files, dirs = [], []
+ # Not all modules are required to have a __file__ attribute. See
+ # PEP 420 for more details.
+ if hasattr(os, '__file__'):
+ here = os.path.dirname(os.__file__)
+ files.extend(["LICENSE.txt", "LICENSE"])
+ dirs.extend([os.path.join(here, os.pardir), here, os.curdir])
builtins.license = _sitebuiltins._Printer(
"license",
"See http://www.python.org/download/releases/%.5s/license" % sys.version,
- ["LICENSE.txt", "LICENSE"],
- [os.path.join(here, os.pardir), here, os.curdir])
+ files, dirs)
def sethelper():