本文整理汇总了Python中Cython.Distutils.build_ext.run方法的典型用法代码示例。如果您正苦于以下问题:Python build_ext.run方法的具体用法?Python build_ext.run怎么用?Python build_ext.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cython.Distutils.build_ext
的用法示例。
在下文中一共展示了build_ext.run方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def run(self):
optional = True
disabled = True
for ext in self.extensions:
with_ext = self.distribution.ext_status(ext)
if with_ext is None:
disabled = False
elif with_ext:
optional = False
disabled = False
break
if disabled:
return
try:
_build_ext.run(self)
except DistutilsPlatformError:
exc = sys.exc_info()[1]
if optional:
log.warn(str(exc))
log.warn("skipping build_ext")
else:
raise
示例2: run
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def run(self):
if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)),"__libdarknet","libdarknet.so")):
logging.info("removing __libdarknet/libdarknet.so")
os.remove(os.path.join(os.path.dirname(__file__),"__libdarknet","libdarknet.so"))
if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), "libdarknet.so")):
logging.info("removing libdarknet.so")
os.remove(os.path.join(os.path.dirname(os.path.abspath(__file__)),"libdarknet.so"))
if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)),"pydarknet.cpp")):
logging.info("removing pydarknet.cpp")
os.remove(os.path.join(os.path.dirname(os.path.abspath(__file__)),"pydarknet.cpp"))
for f in os.listdir(os.path.dirname(os.path.abspath(__file__))):
if f.startswith("pydarknet.") and f.endswith(".so"):
logging.info("removing " + f)
os.remove(os.path.join(os.path.dirname(os.path.abspath(__file__)),f))
clean.run(self)
示例3: run
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def run(self):
build_ext.run(self)
build_dir = Path(self.build_lib)
root_dir = Path(__file__).parent
target_dir = build_dir if not self.inplace else root_dir
self.copy_file(
Path('pgsync') / '__init__.py', root_dir, target_dir
)
示例4: run
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def run(self):
# Import numpy here, only when headers are needed
import numpy
# Add numpy headers to include_dirs
self.include_dirs.append(numpy.get_include())
# Call original build_ext command
build_ext.run(self)
示例5: run
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def run(self):
import numpy
self.include_dirs.append(numpy.get_include())
build_ext.run(self)
示例6: update_version_py
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def update_version_py():
"""Update version.py using "git describe" command"""
if not os.path.isdir('.git'):
print('This does not appear to be a Git repository, leaving version.py unchanged.')
return False
try:
describe_output = subprocess.check_output(['git', 'describe', '--long', '--dirty']).decode('ascii').strip()
except:
print('Unable to run Git, leaving version.py unchanged.')
return False
# output looks like <version tag>-<commits since tag>-g<hash> and can end with '-dirty', e.g. v0.1.0-14-gd9f10e2-dirty
# our version tags look like 'v0.1.0' or 'v0.1' and optionally additional segments (e.g. v0.1.0rc1), see PEP 0440
describe_parts = re.match('^v([0-9]+\.[0-9]+(?:\.[0-9]+)?\S*)-([0-9]+)-g([0-9a-f]+)(?:-(dirty))?$', describe_output)
assert describe_parts is not None, 'Unexpected output from "git describe": {}'.format(describe_output)
version_tag, n_commits, commit_hash, dirty_flag = describe_parts.groups()
version_parts = re.match('^([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(\S*)$', version_tag)
assert version_parts is not None, 'Unexpected version format: {}'.format(version_tag)
version_major, version_minor, version_micro, version_segments = version_parts.groups()
version_major = int(version_major)
version_minor = int(version_minor)
version_micro = int(version_micro) if version_micro is not None else 0
n_commits = int(n_commits)
if dirty_flag is not None:
print('WARNING: Uncommitted changes detected.')
if n_commits > 0:
# non-exact match, dev version
version_micro += 1
version_segments += '.dev{}+{}'.format(n_commits, commit_hash)
# final version string
if version_micro > 0:
version = '{}.{}.{}{}'.format(version_major, version_minor, version_micro, version_segments)
else:
version = '{}.{}{}'.format(version_major, version_minor, version_segments)
with open(version_py_path, 'w') as f:
f.write(version_py_src.format(version=version))
print('Set version to: {}'.format(version))
# success
return True
# update version.py (if we're in a Git repository)
示例7: run
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def run(self):
# create build dir if it doesn't exist
if not os.path.exists(self.cwd_pcl_helper_dir_build):
os.makedirs(self.cwd_pcl_helper_dir_build)
# build pcl_helper
if platform.system() == 'Windows':
self._build_pcl_helper_windows(self.cwd_pcl_helper_dir_build)
else:
self._build_pcl_helper_linux(self.cwd_pcl_helper_dir_build)
示例8: run
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def run(self):
# Import numpy here, only when headers are needed
import numpy
# Add numpy headers to include_dirs
self.include_dirs.append(numpy.get_include())
# Call original build_ext command
_build_ext.run(self)
示例9: run
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def run(self):
try:
build_ext.run(self)
except DistutilsPlatformError:
raise BuildExtFailed()
示例10: run
# 需要导入模块: from Cython.Distutils import build_ext [as 别名]
# 或者: from Cython.Distutils.build_ext import run [as 别名]
def run(self):
# Import numpy here, only when headers are needed
try:
import numpy
except ImportError:
log.critical("Numpy is required to run setup(). Exiting.")
sys.exit(1)
# Add numpy headers to include_dirs
self.include_dirs.append(numpy.get_include())
# Call original build_ext command
build_ext.run(self)