Skip to content

Commit

Permalink
Always copy the python dynamic libraries into lib folder (#518)
Browse files Browse the repository at this point in the history
* Always copy the python dynamic libraries into lib folder

* update
  • Loading branch information
marcelotduarte authored and anthony-tuininga committed Nov 24, 2019
1 parent bc0b19a commit 73748dc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions cx_Freeze/freezer.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,20 @@ def _FreezeExecutable(self, exe):
".py")
finder.IncludeFile(startupModule)

self._CopyFile(exe.base, exe.targetName, copyDependentFiles = True,
includeMode = True)
# Always copy the python dynamic libraries into lib folder
if sys.platform == "linux":
self._CopyFile(exe.base, exe.targetName,
copyDependentFiles=False, includeMode=True)
targetDir = os.path.join(os.path.dirname(exe.targetName), 'lib')
dependentFiles = self._GetDependentFiles(exe.base) or\
self._GetDependentFiles(sys.executable)
for source in dependentFiles:
target = os.path.join(targetDir, os.path.basename(source))
self._CopyFile(source, target,
copyDependentFiles=True, includeMode=True)
else:
self._CopyFile(exe.base, exe.targetName,
copyDependentFiles=True, includeMode=True)
if not os.access(exe.targetName, os.W_OK):
mode = os.stat(exe.targetName).st_mode
os.chmod(exe.targetName, mode | stat.S_IWUSR)
Expand All @@ -200,9 +212,9 @@ def _FreezeExecutable(self, exe):
cx_Freeze.util.AddIcon(exe.targetName, exe.icon)
else:
targetName = os.path.join(os.path.dirname(exe.targetName),
os.path.basename(exe.icon))
os.path.basename(exe.icon))
self._CopyFile(exe.icon, targetName,
copyDependentFiles = False)
copyDependentFiles=False)

if self.metadata is not None and sys.platform == "win32":
self._AddVersionResource(exe)
Expand All @@ -215,7 +227,7 @@ def _GetDefaultBinExcludes(self):
if sys.platform == "win32":
return ["comctl32.dll", "oci.dll", "cx_Logging.pyd"]
else:
return ["libclntsh.so", "libwtc9.so"]
return ["libclntsh.so", "libwtc9.so", "ldd"]

def _GetDefaultBinIncludes(self):
"""Return the file names of libraries which must be included for the
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def build_extension(self, ext):
return
if sys.platform == "win32" and self.compiler.compiler_type == "mingw32":
ext.sources.append("source/bases/manifest.rc")
os.environ["LD_RUN_PATH"] = "${ORIGIN}:${ORIGIN}/../lib"
os.environ["LD_RUN_PATH"] = "${ORIGIN}/../lib:${ORIGIN}/lib"
objects = self.compiler.compile(ext.sources,
output_dir = self.build_temp,
include_dirs = ext.include_dirs,
Expand Down

0 comments on commit 73748dc

Please sign in to comment.