本文整理汇总了Python中distutils.command.build_py.build_py方法的典型用法代码示例。如果您正苦于以下问题:Python build_py.build_py方法的具体用法?Python build_py.build_py怎么用?Python build_py.build_py使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.command.build_py
的用法示例。
在下文中一共展示了build_py.build_py方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def run(self):
"""Build modules, packages, and copy data files to build directory"""
if not self.py_modules and not self.packages:
return
if self.py_modules:
self.build_modules()
if self.packages:
self.build_packages()
self.build_package_data()
self.run_2to3(self.__updated_files, False)
self.run_2to3(self.__updated_files, True)
self.run_2to3(self.__doctests_2to3, True)
# Only compile actual .py files, using our base class' idea of what our
# output files are.
self.byte_compile(orig.build_py.get_outputs(self, include_bytecode=0))
示例2: finalize_options
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def finalize_options(self):
orig.build_py.finalize_options(self)
self.package_data = self.distribution.package_data
self.exclude_package_data = (self.distribution.exclude_package_data or
{})
if 'data_files' in self.__dict__:
del self.__dict__['data_files']
self.__updated_files = []
self.__doctests_2to3 = []
示例3: __getattr__
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def __getattr__(self, attr):
"lazily compute data files"
if attr == 'data_files':
self.data_files = self._get_data_files()
return self.data_files
return orig.build_py.__getattr__(self, attr)
示例4: build_module
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def build_module(self, module, module_file, package):
outfile, copied = orig.build_py.build_module(self, module, module_file,
package)
if copied:
self.__updated_files.append(outfile)
return outfile, copied
示例5: check_package
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def check_package(self, package, package_dir):
"""Check namespace packages' __init__ for declare_namespace"""
try:
return self.packages_checked[package]
except KeyError:
pass
init_py = orig.build_py.check_package(self, package, package_dir)
self.packages_checked[package] = init_py
if not init_py or not self.distribution.namespace_packages:
return init_py
for pkg in self.distribution.namespace_packages:
if pkg == package or pkg.startswith(package + '.'):
break
else:
return init_py
with io.open(init_py, 'rb') as f:
contents = f.read()
if b'declare_namespace' not in contents:
raise distutils.errors.DistutilsError(
"Namespace package problem: %s is a namespace package, but "
"its\n__init__.py does not call declare_namespace()! Please "
'fix it.\n(See the setuptools manual under '
'"Namespace Packages" for details.)\n"' % (package,)
)
return init_py
示例6: get_package_dir
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def get_package_dir(self, package):
res = orig.build_py.get_package_dir(self, package)
if self.distribution.src_root is not None:
return os.path.join(self.distribution.src_root, res)
return res
示例7: build_module
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def build_module(self, module, module_file, package):
if six.PY2 and isinstance(package, six.string_types):
# avoid errors on Python 2 when unicode is passed (#190)
package = package.split('.')
outfile, copied = orig.build_py.build_module(self, module, module_file,
package)
if copied:
self.__updated_files.append(outfile)
return outfile, copied
示例8: initialize_options
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def initialize_options(self):
self.packages_checked = {}
orig.build_py.initialize_options(self)
示例9: finalize_options
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def finalize_options(self):
orig.build_py.finalize_options(self)
self.package_data = self.distribution.package_data
self.exclude_package_data = self.distribution.exclude_package_data or {}
if 'data_files' in self.__dict__: del self.__dict__['data_files']
self.__updated_files = []
self.__doctests_2to3 = []
示例10: __getattr__
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def __getattr__(self, attr):
if attr=='data_files': # lazily compute data files
self.data_files = files = self._get_data_files()
return files
return orig.build_py.__getattr__(self,attr)
示例11: build_module
# 需要导入模块: from distutils.command import build_py [as 别名]
# 或者: from distutils.command.build_py import build_py [as 别名]
def build_module(self, module, module_file, package):
outfile, copied = orig.build_py.build_module(self, module, module_file, package)
if copied:
self.__updated_files.append(outfile)
return outfile, copied