deploy-ng: fixes for FreeBSD

This commit is contained in:
rdb 2017-09-19 22:03:44 +02:00
parent 5cf2f92597
commit 1c018f5bdb
3 changed files with 21 additions and 4 deletions

View File

@ -750,9 +750,12 @@ class Freezer:
('.abi{0}.so'.format(sys.version_info[0]), 'rb', 3),
('.so', 'rb', 3),
]
else:
print("Unknown platform %s" % (self.platform))
self.moduleSuffixes = imp.get_suffixes()
else: # FreeBSD et al.
self.moduleSuffixes += [
('.cpython-{0}{1}m.so'.format(*sys.version_info), 'rb', 3),
('.abi{0}.so'.format(*sys.version_info), 'rb', 3),
('.so', 'rb', 3),
]
def excludeFrom(self, freezer):
""" Excludes all modules that have already been processed by

View File

@ -78,7 +78,7 @@ class build_apps(distutils.core.Command):
whldir = os.path.join(self.build_base, '__whl_cache__')
abi_tag = pip.pep425tags.get_abi_tag()
if 'u' in abi_tag and not platform.startswith('manylinux'):
if 'u' in abi_tag and (platform.startswith('win') or platform.startswith('macosx')):
abi_tag = abi_tag.replace('u', '')
pip_args = [

View File

@ -3,6 +3,9 @@
#include "Python.h"
#ifdef _WIN32
#include "malloc.h"
#ifdef __FreeBSD__
#include <sys/sysctl.h>
#endif
#include <stdio.h>
@ -165,7 +168,18 @@ int main(int argc, char *argv[]) {
wchar_t buffer[2048];
GetModuleFileNameW(NULL, buffer, 2048);
runtime = _wfopen(buffer, L"rb");
#elif defined(__FreeBSD__)
size_t bufsize = 4096;
char buffer[4096];
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
mib[3] = getpid();
if (sysctl(mib, 4, (void *)buffer, &bufsize, NULL, 0) == -1) {
perror("sysctl");
return 1;
}
runtime = fopen(buffer, "rb");
#else
// Let's hope that it was invoked with the executable name as first arg.
runtime = fopen(argv[0], "rb");
#endif