def get_ext_filename(self, ext_name): filename = _build_ext.get_ext_filename(self, ext_name) so_ext = get_config_var('SO') soabi = get_config_var('SOABI') if soabi and os.uname()[0] == 'Darwin': filename = "%s.%s%s" % (filename[:-len(so_ext)], soabi, so_ext) return filename
def __init__(self, dist): install_lib.__init__(self, dist) # Append whichever platform specific extension to the jsbsim module # name build_ext = self.get_finalized_command('build_ext') self.module_name = build_ext.get_ext_filename( build_ext.extensions[0].name)
def get_ext_filename(self, ext_name): filename = _build_ext.get_ext_filename(self, ext_name) so_ext = get_config_var('SO') soabi = get_config_var('SOABI') if sys.version_info < (3, 5) and soabi and platform == 'Darwin': filename = "%s.%s%s" % (filename[:-len(so_ext)], soabi, so_ext) return filename
def run(self): # do the normal cleanup clean.run(self) # try to remove '_composite.{so,pyd,...}' extension, # regardless of the current system's extension name convention build_ext = self.get_finalized_command('build_ext') ext_fname = build_ext.get_ext_filename('overviewer_core.c_overviewer') versionpath = os.path.join("overviewer_core", "overviewer_version.py") primspath = os.path.join("overviewer_core", "src", "primitives.h") for fname in [ext_fname, primspath]: if os.path.exists(fname): try: log.info("removing '%s'", fname) if not self.dry_run: os.remove(fname) except OSError: log.warn("'%s' could not be cleaned -- permission denied", fname) else: log.debug("'%s' does not exist -- can't clean it", fname) # now try to purge all *.pyc files for root, dirs, files in os.walk( os.path.join(os.path.dirname(__file__), ".")): for f in files: if f.endswith(".pyc"): if self.dry_run: log.warn("Would remove %s", os.path.join(root, f)) else: os.remove(os.path.join(root, f))
def run(self): # do the normal cleanup clean.run(self) # try to remove '_composite.{so,pyd,...}' extension, # regardless of the current system's extension name convention build_ext = self.get_finalized_command('build_ext') ext_fname = build_ext.get_ext_filename('overviewer_core.c_overviewer') versionpath = os.path.join("overviewer_core", "overviewer_version.py") primspath = os.path.join("overviewer_core", "src", "primitives.h") for fname in [ext_fname, primspath]: if os.path.exists(fname): try: log.info("removing '%s'", fname) if not self.dry_run: os.remove(fname) except OSError: log.warn("'%s' could not be cleaned -- permission denied", fname) else: log.debug("'%s' does not exist -- can't clean it", fname) # now try to purge all *.pyc files for root, dirs, files in os.walk(os.path.join(os.path.dirname(__file__), ".")): for f in files: if f.endswith(".pyc"): if self.dry_run: log.warn("Would remove %s", os.path.join(root,f)) else: os.remove(os.path.join(root, f))
def get_ext_filename(self, fullname): """Convert the name of an extension (eg. "foo.bar") into the name of the file from which it will be loaded (eg. "foo/bar.so", or "foo\bar.pyd"). """ from distutils.command.build_ext import build_ext as _du_build_ext return _du_build_ext.get_ext_filename(self, fullname)
def test_get_ext_filename(self): # setuptools needs to give back the same # result than distutils, even if the fullname # is not in ext_map dist = Distribution() cmd = build_ext(dist) cmd.ext_map['foo/bar'] = '' res = cmd.get_ext_filename('foo') wanted = distutils_build_ext.get_ext_filename(cmd, 'foo') assert res == wanted
def get_ext_filename(self, ext_name): # since python3.5, python extensions' shared libraries use a suffix that corresponds to the value # of sysconfig.get_config_var('EXT_SUFFIX') and contains info about the architecture the library targets. # E.g. on x64 linux the suffix is ".cpython-XYZ-x86_64-linux-gnu.so" # When crosscompiling python wheels, we need to be able to override this suffix # so that the resulting file name matches the target architecture and we end up with a well-formed # wheel. filename = _build_ext.get_ext_filename(self, ext_name) orig_ext_suffix = sysconfig.get_config_var("EXT_SUFFIX") new_ext_suffix = os.getenv("PROTOCOL_BUFFERS_OVERRIDE_EXT_SUFFIX") if new_ext_suffix and filename.endswith(orig_ext_suffix): filename = filename[:-len(orig_ext_suffix)] + new_ext_suffix return filename
def run(self): # do the normal cleanup clean.run(self) # try to remove 'OIL.{so,pyd,...}' extension, # regardless of the current system's extension name convention build_ext = self.get_finalized_command("build_ext") fname = build_ext.get_ext_filename("OIL") if os.path.exists(fname): try: log.info("removing '%s'", fname) if not self.dry_run: os.remove(fname) except OSError: log.warn("'%s' could not be cleaned -- permission denied", fname) else: log.debug("'%s' does not exist -- can't clean it", fname)
def run(self): # do the normal cleanup clean.run(self) # try to remove 'OIL.{so,pyd,...}' extension, # regardless of the current system's extension name convention build_ext = self.get_finalized_command('build_ext') fname = build_ext.get_ext_filename('OIL') if os.path.exists(fname): try: log.info("removing '%s'", fname) if not self.dry_run: os.remove(fname) except OSError: log.warn("'%s' could not be cleaned -- permission denied", fname) else: log.debug("'%s' does not exist -- can't clean it", fname)
def get_ext_filename(self, ext_name): return path_splitext(build_ext.get_ext_filename(self, ext_name))[0]
def get_ext_filename(self, ext_name): filename = _build_ext.get_ext_filename(self, ext_name) so_ext = get_config_var('SO') kxver = self.distribution.kxver return filename[:-len(so_ext)] + kxver.split('.')[0] + so_ext
def get_ext_filename(self, ext_name): if self._ctypes: return ext_name.split('.')[-1] + '.so' return build_ext.get_ext_filename(self, ext_name)
def get_ext_filename(self, ext_name): filename = _build_ext.get_ext_filename(self, ext_name) so_ext = get_config_var('SO') kxver = self.distribution.kxver return filename[:-len(so_ext)] + kxver.replace('.', '_') + so_ext
def get_ext_filename(self, ext_name): return build_ext.get_ext_filename(self, ext_name).replace(".so",".pyd")
def get_ext_filename(self, ext_name): if self._ctypes: return ext_name.split(".")[-1] + ".so" return build_ext.get_ext_filename(self, ext_name)
def get_ext_filename(self, ext_name): return build_ext.get_ext_filename(self, ext_name).replace(".so", ".pyd")
def get_ext_filename(self, ext_name): filename = _build_ext.get_ext_filename(self, ext_name) so_ext = get_config_var('SO') return filename[:-len(so_ext)] + so_ext