def finalize_options(self): self.cmdclass['config'] = config self.cmdclass['build'] = build self.cmdclass['build_py'] = build_py self.cmdclass['build_qk'] = build_qk self.cmdclass['build_ext'] = build_ext self.cmdclass['build_qext'] = build_qext self.cmdclass['install'] = install self.cmdclass['install_qlib'] = install_qlib self.cmdclass['install_qext'] = install_qext self.qhome = os.getenv('QHOME') or os.path.join(os.getenv('HOME'), 'q') u = os.uname() if u[0] == 'Linux': o = 'l' elif u[0] == 'SunOS': o = 'v' if u[-1] == 'i86pc' else 's' else: sys.stderr.write("Unknown platform: %s\n" % str(u)) sys.exit(1) bits = 8 * get_config_var('SIZEOF_VOID_P') self.qarch = "%s%d" % (o, bits) self.install_data = os.path.join(self.qhome, self.qarch) self.kxver = self.get_kxver(self.qhome) self.qexecutable = os.path.join(self.qhome, self.qarch, 'q') _Distribution.finalize_options(self) for ext in self.ext_modules + self.qext_modules: ext.define_macros.append(('KXVER', self.kxver[0])) ext.define_macros.append(('QVER', self.kxver.replace('.', '_'))) if sys.hexversion >= 0x3000000: ext.define_macros.append(('PY3K', '1'))
def finalize_options(self): self.cmdclass['config'] = config self.cmdclass['build'] = build self.cmdclass['build_qk'] = build_qk self.cmdclass['build_ext'] = build_ext self.cmdclass['build_qext'] = build_qext self.cmdclass['install'] = install self.cmdclass['install_qlib'] = install_qlib self.cmdclass['install_qext'] = install_qext self.qhome = os.getenv('QHOME') or os.path.join(os.getenv('HOME'), 'q') u = os.uname() if u[0] == 'Linux': o = 'l' elif u[0] == 'SunOS': o = 'v' if u[-1] == 'i86pc' else 's' else: sys.stderr.write("Unknown platform: %s\n" % str(u)) sys.exit(1) self.qarch = o+('32', '64')[sys.maxint > 2147483647] self.install_data = os.path.join(self.qhome, self.qarch) self.kxver = self.get_kxver(self.qhome) self.qexecutable = os.path.join(self.qhome, self.qarch, 'q') _Distribution.finalize_options(self) for ext in self.ext_modules + self.qext_modules: ext.define_macros.append(('KXVER', self.kxver[0]))
def finalize_options(self): Distribution.finalize_options(self) try: i = self.script_args.index('--disable-ext') except ValueError: self.disable_ext = False else: self.disable_ext = True self.script_args.pop(i)
def finalize_options(self): _Distribution.finalize_options(self) if self.features: self._set_global_opts_from_features() for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): value = getattr(self,ep.name,None) if value is not None: ep.require(installer=self.fetch_build_egg) ep.load()(self, ep.name, value)
def finalize_options(self): _Distribution.finalize_options(self) if self.features: self._set_global_opts_from_features() for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): value = getattr(self, ep.name, None) if value is not None: ep.require(installer=self.fetch_build_egg) ep.load()(self, ep.name, value)
def finalize_options(self): _Distribution.finalize_options(self) for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): value = getattr(self,ep.name,None) if value is not None: ep.require(installer=self.fetch_build_egg) ep.load()(self, ep.name, value) if getattr(self, 'convert_2to3_doctests', None): # XXX may convert to set here when we can rely on set being builtin self.convert_2to3_doctests = [os.path.abspath(p) for p in self.convert_2to3_doctests] else: self.convert_2to3_doctests = []
def finalize_options(self): _Distribution.finalize_options(self) if self.features: self._set_global_opts_from_features() for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): value = getattr(self, ep.name, None) if value is not None: ep.require(installer=self.fetch_build_egg) ep.load()(self, ep.name, value) if getattr(self, 'convert_2to3_doctests', None): # XXX may convert to set here when we can rely on set being builtin self.convert_2to3_doctests = [os.path.abspath(p) for p in self.convert_2to3_doctests] else: self.convert_2to3_doctests = []
def finalize_options(self): if sys.version < '2.5': # Run the setter functions for the metadata fields that have them. # Only those fields that have a supplied value (not None) will # be considered. for name, value in vars(self.metadata).items(): if value is not None: try: setter = getattr(self.metadata, 'set_' + name) except AttributeError: pass else: setter(value) requires_python = self.get_requires_python() if requires_python: requires_python = 'Python (%s)' % ', '.join(requires_python) requires_python = Version.VersionPredicate(requires_python) python_version = version.StrictVersion() python_version.version = sys.version_info[:3] python_version.prerelease = sys.version_info[3:] if not requires_python.satisfied_by(python_version): raise DistutilsSetupError( "%s requires %s" % (self.metadata.name, requires_python)) # Initialize the containter type data variables before dealing # with the information from the package defintions. if self.packages is None: self.packages = [] if self.package_dir is None: self.package_dir = {} if self.py_modules is None: self.py_modules = [] if self.libraries is None: self.libraries = [] if self.headers is None: self.headers = [] if self.ext_modules is None: self.ext_modules = [] if self.include_dirs is None: self.include_dirs = [] if self.scripts is None: self.scripts = [] if self.data_files is None: self.data_files = [] if self.package_file is None: self.package_file = self.script_name if self.namespace_packages is None: self.namespace_packages = [] # Per PEP 314, only use License and Platform if they can't be # handled by an appropriate classifier. Or, in our case, aren't # being handled by a classifier entry. has_platform = has_license = False for classifier in self.get_classifiers(): category = classifier.split('::', 1)[0] category = category.strip().title() if category == 'Operating System': has_platform = True elif category == 'License': has_license = True if self.metadata.license and has_license: raise DistutilsSetupError("license keyword conflicts with" " classifiers list") if self.metadata.platforms and has_platform: raise DistutilsSetupError("platforms keyword conflicts with" " classifiers list") # Finalize "private" variables; those that are not part of the # setup arguments. self._allfiles = None Distribution.finalize_options(self)
def d2to1(dist, attr, value): """Implements the actual d2to1 setup() keyword. When used, this should be the only keyword in your setup() aside from `setup_requires`. If given as a string, the value of d2to1 is assumed to be the relative path to the setup.cfg file to use. Otherwise, if it evaluates to true, it simply assumes that d2to1 should be used, and the default 'setup.cfg' is used. This works by reading the setup.cfg file, parsing out the supported metadata and command options, and using them to rebuild the `DistributionMetadata` object and set the newly added command options. The reason for doing things this way is that a custom `Distribution` class will not play nicely with setup_requires; however, this implementation may not work well with distributions that do use a `Distribution` subclass. """ if not value: return if isinstance(value, six.string_types): path = os.path.abspath(value) else: path = os.path.abspath('setup.cfg') if not os.path.exists(path): raise DistutilsFileError( 'The setup.cfg file %s does not exist.' % path) # Converts the setup.cfg file to setup() arguments try: attrs = cfg_to_args(path) except: e = sys.exc_info()[1] raise DistutilsSetupError( 'Error parsing %s: %s: %s' % (path, e.__class__.__name__, e.args[0])) # Repeat some of the Distribution initialization code with the newly # provided attrs if attrs: # Skips 'options' and 'licence' support which are rarely used; may add # back in later if demanded for key, val in six.iteritems(attrs): if hasattr(dist.metadata, 'set_' + key): getattr(dist.metadata, 'set_' + key)(val) elif hasattr(dist.metadata, key): setattr(dist.metadata, key, val) elif hasattr(dist, key): setattr(dist, key, val) else: msg = 'Unknown distribution option: %s' % repr(key) warnings.warn(msg) # Re-finalize the underlying Distribution _Distribution.finalize_options(dist) # This bit comes out of distribute/setuptools if isinstance(dist.metadata.version, six.integer_types + (float,)): # Some people apparently take "version number" too literally :) dist.metadata.version = str(dist.metadata.version) # This bit of hackery is necessary so that the Distribution will ignore # normally unsupport command options (namely pre-hooks and post-hooks). # dist.command_options is normally a dict mapping command names to dicts of # their options. Now it will be a defaultdict that returns IgnoreDicts for # the each command's options so we can pass through the unsupported options ignore = ['pre_hook.*', 'post_hook.*'] dist.command_options = DefaultGetDict(lambda: IgnoreDict(ignore))
Extension("cysignals.alarm", ["src/cysignals/alarm.pyx"], **kwds), Extension("cysignals.tests", ["src/cysignals/tests.pyx"], **kwds) ] # Run configure if it wasn't run before. We check this by the presence # of config.pxd config_pxd_file = opj(cythonize_dir, "src", "config.pxd") if not os.path.isfile(config_pxd_file): import subprocess subprocess.check_call("make configure && ./configure", shell=True) # Determine installation directory from distutils inst = Distribution().get_command_obj("install") inst.finalize_options() install_dir = opj(inst.install_platlib, "cysignals") # Add an __init__.pxd file setting the correct compiler options. # The variable "init_pxd" is the string which should be written to # __init__.pxd init_pxd = "# distutils: include_dirs = {0}\n".format(install_dir) # Append config.pxd with open(config_pxd_file) as c: init_pxd += c.read() # First, try to read the existing __init__.pxd file and write it only # if it changed. init_pxd_file = opj(cythonize_dir, "src", "cysignals", "__init__.pxd") try:
# provided attrs if attrs: # Skips 'options' and 'licence' support which are rarely used; may add # back in later if demanded for key, val in attrs.iteritems(): if hasattr(dist.metadata, 'set_' + key): getattr(dist.metadata, 'set_' + key)(val) elif hasattr(dist.metadata, key): setattr(dist.metadata, key, val) elif hasattr(dist, key): setattr(dist, key, val) else: msg = 'Unknown distribution option: %s' % repr(key) warnings.warn(msg) # Re-finalize the underlying Distribution _Distribution.finalize_options(dist) # This bit comes out of distribute/setuptools if isinstance(dist.metadata.version, (int, long, float)): # Some people apparently take "version number" too literally :) dist.metadata.version = str(dist.metadata.version) # This bit of hackery is necessary so that the Distribution will ignore # normally unsupport command options (namely pre-hooks and post-hooks). # dist.command_options is normally a dict mapping command names to dicts of # their options. Now it will be a defaultdict that returns IgnoreDicts for # the each command's options so we can pass through the unsupported options ignore = ['pre_hook.*', 'post_hook.*'] dist.command_options = DefaultGetDict(lambda: IgnoreDict(ignore))