Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/cffi/_shimmed_dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
from distutils.dir_util import mkpath
from distutils.errors import DistutilsSetupError, CompileError, LinkError
from distutils.log import set_threshold, set_verbosity

if sys.platform == 'win32':
from distutils.msvc9compiler import MSVCCompiler
except Exception as ex:
if sys.version_info >= (3, 12):
raise Exception("This CFFI feature requires setuptools on Python >= 3.12. Please install the setuptools package.") from ex
Expand Down
6 changes: 0 additions & 6 deletions src/cffi/recompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,12 +1481,6 @@ def _unpatch_meths(patchlist):
setattr(cls, name, old_meth)

def _patch_for_embedding(patchlist):
if sys.platform == 'win32':
# we must not remove the manifest when building for embedding!
from cffi._shimmed_dist_utils import MSVCCompiler
_patch_meth(patchlist, MSVCCompiler, '_remove_visual_c_ref',
lambda self, manifest_file: manifest_file)

if sys.platform == 'darwin':
# we must not make a '-bundle', but a '-dynamiclib' instead
from cffi._shimmed_dist_utils import CCompiler
Expand Down
26 changes: 7 additions & 19 deletions testing/cffi0/test_ownlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,13 @@ def setup_class(cls):
return
# try (not too hard) to find the version used to compile this python
# no mingw
from distutils.msvc9compiler import get_build_version
version = get_build_version()
toolskey = "VS%0.f0COMNTOOLS" % version
toolsdir = os.environ.get(toolskey, None)
if toolsdir is None:
return
productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC")
productdir = os.path.abspath(productdir)
vcvarsall = os.path.join(productdir, "vcvarsall.bat")
# 64?
arch = 'x86'
if sys.maxsize > 2**32:
arch = 'amd64'
if os.path.isfile(vcvarsall):
cmd = '"%s" %s' % (vcvarsall, arch) + ' & cl.exe testownlib.c ' \
' /LD /Fetestownlib.dll'
subprocess.check_call(cmd, cwd = str(udir), shell=True)
os.rename(str(udir) + '\\testownlib.dll', dll_path)
cls.module = dll_path
from setuptools.command.build_ext import new_compiler
compiler = new_compiler()
objs = compiler.compile([str(udir) + "\\testownlib.c"], output_dir=str(udir))
compiler.link_shared_lib(objs, str(udir) + "\\testownlib", extra_preargs = ["/DLL"])

os.rename(str(udir) + '\\testownlib.dll', dll_path)
cls.module = dll_path
else:
encoded = None
if cls.Backend is not CTypesBackend:
Expand Down
2 changes: 1 addition & 1 deletion testing/cffi0/test_zdistutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_compile_module_explicit_filename(self):
csrc = '/*hi there %s!2*/\n#include <math.h>\n' % self
v = Verifier(ffi, csrc, force_generic_engine=self.generic,
libraries=[self.lib_m])
basename = self.__class__.__name__[:10] + '_test_compile_module'
basename = self.__class__.__name__[4:14] + '_test_compile_module'
v.modulefilename = filename = str(udir.join(basename + '.so'))
v.compile_module()
assert filename == v.modulefilename
Expand Down
2 changes: 1 addition & 1 deletion testing/embedding/empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ffi.embedding_api("")

ffi.set_source("_empty_cffi", """
void initialize_my_empty_cffi(void) {
CFFI_DLLEXPORT void initialize_my_empty_cffi(void) {
if (cffi_start_python() != 0) {
printf("oops, cffi_start_python() returned non-0\\n");
abort();
Expand Down