本文整理汇总了Python中distutils.command.build_ext.USER_BASE属性的典型用法代码示例。如果您正苦于以下问题:Python build_ext.USER_BASE属性的具体用法?Python build_ext.USER_BASE怎么用?Python build_ext.USER_BASE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类distutils.command.build_ext
的用法示例。
在下文中一共展示了build_ext.USER_BASE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_user_site
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def test_user_site(self):
import site
dist = Distribution({'name': 'xx'})
cmd = build_ext(dist)
# making sure the user option is there
options = [name for name, short, label in
cmd.user_options]
self.assertIn('user', options)
# setting a value
cmd.user = 1
# setting user based lib and include
lib = os.path.join(site.USER_BASE, 'lib')
incl = os.path.join(site.USER_BASE, 'include')
os.mkdir(lib)
os.mkdir(incl)
cmd.ensure_finalized()
# see if include_dirs and library_dirs were set
self.assertIn(lib, cmd.library_dirs)
self.assertIn(lib, cmd.rpath)
self.assertIn(incl, cmd.include_dirs)
示例2: setUp
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def setUp(self):
# Create a simple test environment
# Note that we're making changes to sys.path
super(BuildExtTestCase, self).setUp()
self.tmp_dir = self.mkdtemp()
self.sys_path = sys.path, sys.path[:]
sys.path.append(self.tmp_dir)
import site
self.old_user_base = site.USER_BASE
site.USER_BASE = self.mkdtemp()
from distutils.command import build_ext
build_ext.USER_BASE = site.USER_BASE
# bpo-30132: On Windows, a .pdb file may be created in the current
# working directory. Create a temporary working directory to cleanup
# everything at the end of the test.
self.temp_cwd = support.temp_cwd()
self.temp_cwd.__enter__()
self.addCleanup(self.temp_cwd.__exit__, None, None, None)
示例3: setUp
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def setUp(self):
# Create a simple test environment
super(BuildExtTestCase, self).setUp()
self.tmp_dir = self.mkdtemp()
import site
self.old_user_base = site.USER_BASE
site.USER_BASE = self.mkdtemp()
from distutils.command import build_ext
build_ext.USER_BASE = site.USER_BASE
# bpo-30132: On Windows, a .pdb file may be created in the current
# working directory. Create a temporary working directory to cleanup
# everything at the end of the test.
change_cwd = support.change_cwd(self.tmp_dir)
change_cwd.__enter__()
self.addCleanup(change_cwd.__exit__, None, None, None)
示例4: setUp
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def setUp(self):
super(BuildExtTestCase, self).setUp()
self.tmp_dir = self.mkdtemp()
self.xx_created = False
sys.path.append(self.tmp_dir)
self.addCleanup(sys.path.remove, self.tmp_dir)
if sys.version > "2.6":
import site
self.old_user_base = site.USER_BASE
site.USER_BASE = self.mkdtemp()
from distutils.command import build_ext
build_ext.USER_BASE = site.USER_BASE
示例5: setUp
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def setUp(self):
# Create a simple test environment
# Note that we're making changes to sys.path
super(BuildExtTestCase, self).setUp()
self.tmp_dir = self.mkdtemp()
self.sys_path = sys.path, sys.path[:]
sys.path.append(self.tmp_dir)
import site
self.old_user_base = site.USER_BASE
site.USER_BASE = self.mkdtemp()
from distutils.command import build_ext
build_ext.USER_BASE = site.USER_BASE
示例6: tearDown
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def tearDown(self):
# Get everything back to normal
support.unload('xx')
sys.path = self.sys_path[0]
sys.path[:] = self.sys_path[1]
import site
site.USER_BASE = self.old_user_base
from distutils.command import build_ext
build_ext.USER_BASE = self.old_user_base
super(BuildExtTestCase, self).tearDown()
示例7: test_user_site
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def test_user_site(self):
import site
dist = Distribution({'name': 'xx'})
cmd = self.build_ext(dist)
# making sure the user option is there
options = [name for name, short, lable in
cmd.user_options]
self.assertIn('user', options)
# setting a value
cmd.user = 1
# setting user based lib and include
lib = os.path.join(site.USER_BASE, 'lib')
incl = os.path.join(site.USER_BASE, 'include')
os.mkdir(lib)
os.mkdir(incl)
# let's run finalize
cmd.ensure_finalized()
# see if include_dirs and library_dirs
# were set
self.assertIn(lib, cmd.library_dirs)
self.assertIn(lib, cmd.rpath)
self.assertIn(incl, cmd.include_dirs)
示例8: test_user_site
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def test_user_site(self):
import site
dist = Distribution({'name': 'xx'})
cmd = build_ext(dist)
# making sure the user option is there
options = [name for name, short, lable in
cmd.user_options]
self.assertIn('user', options)
# setting a value
cmd.user = 1
# setting user based lib and include
lib = os.path.join(site.USER_BASE, 'lib')
incl = os.path.join(site.USER_BASE, 'include')
os.mkdir(lib)
os.mkdir(incl)
# let's run finalize
cmd.ensure_finalized()
# see if include_dirs and library_dirs
# were set
self.assertIn(lib, cmd.library_dirs)
self.assertIn(lib, cmd.rpath)
self.assertIn(incl, cmd.include_dirs)
示例9: tearDown
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def tearDown(self):
import site
site.USER_BASE = self.old_user_base
from distutils.command import build_ext
build_ext.USER_BASE = self.old_user_base
super(BuildExtTestCase, self).tearDown()
示例10: test_user_site
# 需要导入模块: from distutils.command import build_ext [as 别名]
# 或者: from distutils.command.build_ext import USER_BASE [as 别名]
def test_user_site(self):
# site.USER_SITE was introduced in 2.6
if sys.version < '2.6':
return
import site
dist = Distribution({'name': 'xx'})
cmd = build_ext(dist)
# making sure the user option is there
options = [name for name, short, label in
cmd.user_options]
self.assertIn('user', options)
# setting a value
cmd.user = 1
# setting user based lib and include
lib = os.path.join(site.USER_BASE, 'lib')
incl = os.path.join(site.USER_BASE, 'include')
os.mkdir(lib)
os.mkdir(incl)
cmd.ensure_finalized()
# see if include_dirs and library_dirs were set
self.assertIn(lib, cmd.library_dirs)
self.assertIn(lib, cmd.rpath)
self.assertIn(incl, cmd.include_dirs)