Skip to content

Instantly share code, notes, and snippets.

@solvingj
Last active May 2, 2019 18:49
Show Gist options
  • Save solvingj/87305e0f70e14d738d6989ba2f41352f to your computer and use it in GitHub Desktop.
Save solvingj/87305e0f70e14d738d6989ba2f41352f to your computer and use it in GitHub Desktop.
embeddable-python-layout-and-log
user@user-laptop:~/tmp$ ls -l
total 32300
-rwxrwxrwx 1 user user 58312 May 2 14:21 _asyncio.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 12648 May 2 14:21 _bisect.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 46528 May 2 14:21 _blake2.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 149880 May 2 14:21 _codecs_cn.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 158104 May 2 14:21 _codecs_hk.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 27000 May 2 14:21 _codecs_iso2022.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 264568 May 2 14:21 _codecs_jp.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 137592 May 2 14:21 _codecs_kr.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 113016 May 2 14:21 _codecs_tw.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 6736 May 2 14:21 _crypt.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 38504 May 2 14:21 _csv.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 151920 May 2 14:21 _ctypes.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 18888 May 2 14:21 _ctypes_test.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 100456 May 2 14:21 _datetime.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 350984 May 2 14:21 _decimal.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 65864 May 2 14:21 _elementtree.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 21872 May 2 14:21 _heapq.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 46208 May 2 14:21 _json.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 21408 May 2 14:21 _lsprof.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 16008 May 2 14:21 _md5.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 40232 May 2 14:21 _multibytecodec.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 15920 May 2 14:21 _multiprocessing.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 6512 May 2 14:21 _opcode.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 113448 May 2 14:21 _pickle.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 15824 May 2 14:21 _posixsubprocess.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 15456 May 2 14:21 _random.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 16008 May 2 14:21 _sha1.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 24904 May 2 14:21 _sha256.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 80904 May 2 14:21 _sha3.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 29000 May 2 14:21 _sha512.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 104128 May 2 14:21 _socket.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 46920 May 2 14:21 _struct.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 45896 May 2 14:21 _testbuffer.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 99136 May 2 14:21 _testcapi.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 6520 May 2 14:21 _testimportmultiple.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 22320 May 2 14:21 _testmultiphase.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 60424 May 2 14:21 array.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 39408 May 2 14:21 audioop.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 25656 May 2 14:21 binascii.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 59352 May 2 14:21 cmath.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 18480 May 2 14:21 fcntl.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 12328 May 2 14:21 grp.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 12591824 May 2 14:21 libpython3.6.so
-rwxrwxrwx 1 user user 12591824 May 2 14:21 libpython3.6.so.1.0
-rwxrwxrwx 1 user user 7648 May 2 14:21 libpython3.so
-rwxrwxrwx 1 user user 58032 May 2 14:21 math.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 25408 May 2 14:21 mmap.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 15800 May 2 14:21 nis.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 33288 May 2 14:21 ossaudiodev.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 28464 May 2 14:21 parser.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 258192 May 2 14:21 pyexpat.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 18208 May 2 14:21 python
-rw-rw-rw- 1 user user 74 May 2 14:22 python36._pth
-rw-rw-rw- 1 user user 2215737 May 2 14:22 python36.zip
-rwxrwxrwx 1 user user 15424 May 2 14:21 resource.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 28288 May 2 14:21 select.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 12048 May 2 14:21 spwd.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 10800 May 2 14:21 syslog.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 25040 May 2 14:21 termios.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 894312 May 2 14:21 unicodedata.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 11184 May 2 14:21 xxlimited.cpython-36-x86_64-linux-gnu.so
user@user-laptop:~/tmp$ export LD_LIBRARY_PATH=$(pwd)
user@user-laptop:~/tmp$ export PYTHONHOME=$(pwd)
user@user-laptop:~/tmp$ export PYTHONPATH=$(pwd)
user@user-laptop:~/tmp$ ./python
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007fd46baf1680 (most recent call first):
Aborted (core dumped)
Tools/msi/make_zip.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py
index 0698c14073..1b50d64505 100644
--- a/Tools/msi/make_zip.py
+++ b/Tools/msi/make_zip.py
@@ -123,6 +123,10 @@ EMBED_LAYOUT = [
('/', '$build', 'python*.exe', is_not_debug),
('/', '$build', '*.pyd', is_not_debug),
('/', '$build', '*.dll', is_not_debug),
+ ('/', '$build', 'python', is_not_debug),
+ ('/', '$build', '*.so*', is_not_debug),
+ ('/', '../build/lib.linux-x86_64-{0.major}.{0.minor}'.format(sys.version_info), '*.so*', is_not_debug),
+ ('/', '../build/lib.linux-x86-{0.major}.{0.minor}'.format(sys.version_info), '*.so*', is_not_debug),
('{}.zip'.format(BASE_NAME), 'Lib', '**/*', include_in_embeddable_lib),
]
@@ -161,11 +165,7 @@ def copy_to_layout(target, rel_sources):
dest.parent.mkdir(parents=True)
except FileExistsError:
pass
- if dest.is_file():
- dest.chmod(stat.S_IWRITE)
shutil.copy(str(s), str(dest))
- if dest.is_file():
- dest.chmod(stat.S_IWRITE)
count += 1
return count
@@ -226,7 +226,7 @@ def main():
extra_files = []
if s == 'Lib' and p == '**/*':
extra_files.append((
- source / 'tools' / 'msi' / 'distutils.command.bdist_wininst.py',
+ source / 'Tools' / 'msi' / 'distutils.command.bdist_wininst.py',
Path('distutils') / 'command' / 'bdist_wininst.py'
))
copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment