本文整理汇总了Python中distutils.core.setup方法的典型用法代码示例。如果您正苦于以下问题:Python core.setup方法的具体用法?Python core.setup怎么用?Python core.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.core
的用法示例。
在下文中一共展示了core.setup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_release_tree
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def make_release_tree(self, base_dir, files):
import os
sdist.make_release_tree(self, base_dir, files)
version_file = os.path.join(base_dir, 'VERSION')
print('updating %s' % (version_file,))
# Write to temporary file first and rename over permanent not
# just to avoid atomicity issues (not likely an issue since if
# interrupted the whole sdist directory is only partially
# written) but because the upstream sdist may have made a hard
# link, so overwriting in place will edit the source tree.
with open(version_file + '.tmp', 'wb') as f:
f.write('%s\n' % (pkg_version,))
os.rename(version_file + '.tmp', version_file)
# XXX These should be attributes of `setup', but helpful distutils
# doesn't pass them through when it doesn't know about them a priori.
示例2: win_use_clang
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def win_use_clang():
# Recent (>= 8 ?) LLVM versions does not ship anymore a cl.exe binary in
# the msbuild-bin directory. Thus, we need to
# * copy-paste bin/clang-cl.exe into a temporary directory
# * rename it to cl.exe
# * add that path first in %Path%
# * clean this mess on exit
# We could use the build directory created by distutils for this, but it
# seems non trivial to gather
# (https://stackoverflow.com/questions/12896367/reliable-way-to-get-the-build-directory-from-within-setup-py).
clang_path = win_find_clang_path()
if clang_path is None:
return False
tmpdir = tempfile.mkdtemp(prefix="llvm")
copyfile(os.path.join(clang_path, "bin", "clang-cl.exe"), os.path.join(tmpdir, "cl.exe"))
os.environ['Path'] = "%s;%s" % (tmpdir, os.environ["Path"])
atexit.register(lambda dir_: rmtree(dir_), tmpdir)
return True
示例3: run
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def run(self):
options=['setup', '_bcftools', '_utils']
if not self.minimal:
if not self.no_samtools:
options.append('_samtools')
if not self.no_gem3:
options.append('gem3')
if not self.no_bscall:
options.append('_bs_call')
if not self.enable_cuda:
self.diable_cuda = True
compile_gemBS_tools(options, self.enable_cuda, self.disable_cuda)
_install.run(self)
# find target folder
install_dir = os.path.join(gemBS_install_dir, "gemBS")
_install_bundle(install_dir, self)
示例4: setup_package
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def setup_package():
# rewrite version file
write_version_py()
try:
from numpy.distutils.core import setup
except:
from distutils.core import setup
setup(
name=NAME,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
url=URL,
version=VERSION,
download_url=DOWNLOAD_URL,
license=LICENSE,
classifiers=CLASSIFIERS,
platforms=PLATFORMS,
configuration=configuration,
scripts=SCRIPTS,
)
示例5: copy_for_legacy_python
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def copy_for_legacy_python(src_dir, dest_dir):
from translate_to_legacy import LegacyPythonTranslator
# Dirs and files to explicitly not translate
skip = ['tests/python_sample.py',
'tests/python_sample2.py',
'tests/python_sample3.py']
# Make a fresh copy of the package
if os.path.isdir(dest_dir):
shutil.rmtree(dest_dir)
ignore = lambda src, names: [n for n in names if n == '__pycache__']
shutil.copytree(src_dir, dest_dir, ignore=ignore)
# Translate in-place
LegacyPythonTranslator.translate_dir(dest_dir, skip=skip)
## Collect info for setup()
示例6: InstallPy2exePatch
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def InstallPy2exePatch():
"""
Tricks py2exe to include the win32com module.
ModuleFinder can't handle runtime changes to __path__, but win32com
uses them, particularly for people who build from sources.
"""
try:
import modulefinder
import win32com
for path in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", path)
for extra in ["win32com.shell"]:
__import__(extra)
module = sys.modules[extra]
for path in module.__path__[1:]:
modulefinder.AddPackagePath(extra, path)
except ImportError: # IGNORE:W0704
# no build path setup, no worries.
pass
示例7: post_install_setup
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def post_install_setup():
# Run the KiCost integration script.
try:
import sys
if sys.platform.startswith("win32"):
# For Windows it is necessary one additional library (used to create the shortcut).
print('Installing additional library need for Windows setup...')
try:
if sys.version_info < (3,0):
from pip._internal import main as pipmain
else:
from pip import main as pipmain
pipmain(['install', 'pywin32'])
except:
print('Error to install Windows additional Python library. KiCost configuration related to Windows registry may not work.')
# Run setup: shortcut, BOM module to Eeschema and OS context menu.
try:
from .kicost.kicost_config import kicost_setup
kicost_setup()
except:
print('Running the external configuration command...')
from subprocess import call
call(['kicost', '--setup'])
except:
print('Error to run KiCost integration script.')
示例8: can_parse
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def can_parse(self, path: Path, content: Optional[str] = None) -> bool:
if isinstance(path, str):
path = Path(path)
if path.name == 'setup.py':
return True
if not content:
return False
if 'setuptools' not in content and 'distutils' not in content:
return False
return ('setup(' in content)
示例9: run_tests
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def run_tests(self):
import subprocess
subprocess.check_call(["./check.sh"])
print "Using ./check.sh directly gives you more options for testing."
# XXX These should be attributes of `setup', but helpful distutils
# doesn't pass them through when it doesn't know about them a priori.
示例10: setup
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def setup(**attrs):
from distutils import core
attrs['distclass'] = TwistedDistribution
core.setup(**attrs)
示例11: build_cx_freeze
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def build_cx_freeze(
self, cleanup=True, create_archive=None
):
"""Build executable with cx_Freeze
cleanup: remove 'build/dist' directories before building distribution
create_archive (requires the executable `zip`):
* None or False: do nothing
* 'add': add target directory to a ZIP archive
* 'move': move target directory to a ZIP archive
"""
assert (
not self._py2exe_is_loaded
), "cx_Freeze can't be executed after py2exe"
from cx_Freeze import setup
if cleanup:
self.__cleanup()
sys.argv += ["build"]
build_exe = dict(
include_files=to_include_files(self.data_files),
includes=self.includes,
excludes=self.excludes,
bin_excludes=self.bin_excludes,
bin_includes=self.bin_includes,
bin_path_includes=self.bin_path_includes,
bin_path_excludes=self.bin_path_excludes,
build_exe=self.target_dir,
)
setup(
name=self.name,
version=self.version,
description=self.description,
executables=self.executables,
options=dict(build_exe=build_exe),
)
if create_archive:
self.__create_archive(create_archive)
示例12: write_version_py
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def write_version_py(filename='scikits/umfpack/version.py'):
cnt = """# THIS FILE IS GENERATED FROM scikit-umfpack SETUP.PY
short_version = '%(version)s'
version = '%(version)s'
full_version = '%(full_version)s'
git_revision = '%(git_revision)s'
release = %(isrelease)s
if not release:
version = full_version
"""
FULLVERSION, GIT_REVISION = get_version_info()
a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION,
'full_version': FULLVERSION,
'git_revision': GIT_REVISION,
'isrelease': str(ISRELEASED)})
finally:
a.close()
###############################################################################
# Optional setuptools features
# We need to import setuptools early, if we want setuptools features,
# as it monkey-patches the 'setup' function
# For some commands, use setuptools
示例13: get_all_resources
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def get_all_resources():
import logging # noqa - prevent mixup with logging module inside flexx.util
sys.path.insert(0, os.path.join(THIS_DIR, 'flexx', 'util'))
from getresource import RESOURCES, get_resoure_path
for name in RESOURCES.keys():
get_resoure_path(name)
sys.path.pop(0)
## Collect info for setup()
示例14: write_script
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def write_script(self, script_name, contents, mode="t", *ignored):
i = contents.find('__requires__')
if i >= 0:
j = contents.rfind('\n', 0, i)
if j >= 0:
contents = contents[:j+1] + "import sys\nsys.path.insert(0,'{}')\n".format(gemBS_install_dir) + contents[j+1:]
_install_scripts.write_script(self, script_name, contents, mode, *ignored)
# hack the setup tools cleaning
示例15: main
# 需要导入模块: from distutils import core [as 别名]
# 或者: from distutils.core import setup [as 别名]
def main(properties=properties, options=options, **custom_options):
"""Imports and runs setup function with given properties."""
return init(**dict(options, **custom_options))(**properties)