mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
deploy-ng: fix issues with Mac/Python 2 build
This commit is contained in:
parent
70386795f4
commit
f001bd20d7
@ -1556,10 +1556,10 @@ class Freezer:
|
|||||||
if getattr(module, "__path__", None):
|
if getattr(module, "__path__", None):
|
||||||
# Indicate package by negative size
|
# Indicate package by negative size
|
||||||
size = -size
|
size = -size
|
||||||
return struct.pack('<256sIi', bytes(modulename, 'ascii'), offset, size)
|
return struct.pack('<256sIi', modulename.encode('ascii'), offset, size)
|
||||||
|
|
||||||
def make_forbidden_module_list_entry(modulename):
|
def make_forbidden_module_list_entry(modulename):
|
||||||
return struct.pack('<256sIi', bytes(modulename, 'ascii'), 0, 0)
|
return struct.pack('<256sIi', modulename.encode('ascii'), 0, 0)
|
||||||
|
|
||||||
# We must have a __main__ module to make an exe file.
|
# We must have a __main__ module to make an exe file.
|
||||||
if not self.__writingModule('__main__'):
|
if not self.__writingModule('__main__'):
|
||||||
|
@ -52,8 +52,11 @@ class build(distutils.command.build.build):
|
|||||||
distutils.dir_util.copy_tree(src, dst)
|
distutils.dir_util.copy_tree(src, dst)
|
||||||
|
|
||||||
for item in os.listdir(libdir):
|
for item in os.listdir(libdir):
|
||||||
if '.so.' in item or item.endswith('.dll') or 'libpandagl' in item:
|
if '.so.' in item or item.endswith('.dll') or item.endswith('.dylib') or 'libpandagl' in item:
|
||||||
distutils.file_util.copy_file(os.path.join(libdir, item), os.path.join(builddir, item))
|
source_path = os.path.join(libdir, item)
|
||||||
|
target_path = os.path.join(builddir, item)
|
||||||
|
if not os.path.islink(source_path):
|
||||||
|
distutils.file_util.copy_file(source_path, target_path)
|
||||||
|
|
||||||
# Copy etc
|
# Copy etc
|
||||||
src = os.path.join(dtool_dir, '..', 'etc')
|
src = os.path.join(dtool_dir, '..', 'etc')
|
||||||
@ -64,8 +67,7 @@ class build(distutils.command.build.build):
|
|||||||
ignore_copy_list = [
|
ignore_copy_list = [
|
||||||
'__pycache__',
|
'__pycache__',
|
||||||
self.distribution.mainfile,
|
self.distribution.mainfile,
|
||||||
*freezer.getAllModuleNames(),
|
] + freezer.getAllModuleNames()
|
||||||
]
|
|
||||||
|
|
||||||
for item in os.listdir(gamedir):
|
for item in os.listdir(gamedir):
|
||||||
src = os.path.join(gamedir, item)
|
src = os.path.join(gamedir, item)
|
||||||
|
@ -122,11 +122,13 @@ Py_FrozenMain(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
sts = 0;
|
sts = 0;
|
||||||
|
|
||||||
|
#if PY_MAJOR_VERSION >= 3
|
||||||
n = PyImport_ImportFrozenModule("_frozen_importlib");
|
n = PyImport_ImportFrozenModule("_frozen_importlib");
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
Py_FatalError("_frozen_importlib not frozen");
|
Py_FatalError("_frozen_importlib not frozen");
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (inspect && isatty((int)fileno(stdin)))
|
if (inspect && isatty((int)fileno(stdin)))
|
||||||
sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
|
sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
|
||||||
@ -153,7 +155,7 @@ error:
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
struct _frozen *_PyImport_FrozenModules;
|
struct _frozen *_PyImport_FrozenModules;
|
||||||
unsigned int listoff, modsoff, fsize, modsize, listsize, nummods;
|
unsigned int listoff, modsoff, fsize, modsize, listsize, nummods, modidx;
|
||||||
FILE *runtime = fopen(argv[0], "rb");
|
FILE *runtime = fopen(argv[0], "rb");
|
||||||
|
|
||||||
// Get offsets
|
// Get offsets
|
||||||
@ -173,7 +175,7 @@ main(int argc, char *argv[]) {
|
|||||||
// Read module list
|
// Read module list
|
||||||
_PyImport_FrozenModules = calloc(nummods + 1, sizeof(struct _frozen));
|
_PyImport_FrozenModules = calloc(nummods + 1, sizeof(struct _frozen));
|
||||||
fseek(runtime, listoff, SEEK_SET);
|
fseek(runtime, listoff, SEEK_SET);
|
||||||
for (unsigned int modidx = 0; modidx < nummods; ++modidx) {
|
for (modidx = 0; modidx < nummods; ++modidx) {
|
||||||
struct _frozen *moddef = &_PyImport_FrozenModules[modidx];
|
struct _frozen *moddef = &_PyImport_FrozenModules[modidx];
|
||||||
char *name = NULL, namebuf[256] = {0};
|
char *name = NULL, namebuf[256] = {0};
|
||||||
unsigned int nsize, codeptr;
|
unsigned int nsize, codeptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user