Python distutils.command.install_lib.install_lib() Examples
The following are 30
code examples of distutils.command.install_lib.install_lib().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
distutils.command.install_lib
, or try the search function
.
Example #1
Source File: test_install_lib.py From Imogen with MIT License | 6 votes |
def test_get_inputs(self): project_dir, dist = self.create_dist() os.chdir(project_dir) os.mkdir('spam') cmd = install_lib(dist) # setting up a dist environment cmd.compile = cmd.optimize = 1 cmd.install_dir = self.mkdtemp() f = os.path.join(project_dir, 'spam', '__init__.py') self.write_file(f, '# python package') cmd.distribution.ext_modules = [Extension('foo', ['xxx'])] cmd.distribution.packages = ['spam'] cmd.distribution.script_name = 'setup.py' # get_inputs should return 2 elements: spam/__init__.py and # foo.import-tag-abiflags.so / foo.pyd inputs = cmd.get_inputs() self.assertEqual(len(inputs), 2, inputs)
Example #2
Source File: test_install_lib.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_get_inputs(self): pkg_dir, dist = self.create_dist() cmd = install_lib(dist) # setting up a dist environment cmd.compile = cmd.optimize = 1 cmd.install_dir = pkg_dir f = os.path.join(pkg_dir, 'foo.py') self.write_file(f, '# python file') cmd.distribution.py_modules = [pkg_dir] cmd.distribution.ext_modules = [Extension('foo', ['xxx'])] cmd.distribution.packages = [pkg_dir] cmd.distribution.script_name = 'setup.py' # get_input should return 2 elements self.assertEqual(len(cmd.get_inputs()), 2)
Example #3
Source File: test_install_lib.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_get_outputs(self): pkg_dir, dist = self.create_dist() cmd = install_lib(dist) # setting up a dist environment cmd.compile = cmd.optimize = 1 cmd.install_dir = pkg_dir f = os.path.join(pkg_dir, 'foo.py') self.write_file(f, '# python file') cmd.distribution.py_modules = [pkg_dir] cmd.distribution.ext_modules = [Extension('foo', ['xxx'])] cmd.distribution.packages = [pkg_dir] cmd.distribution.script_name = 'setup.py' # get_output should return 4 elements self.assertGreaterEqual(len(cmd.get_outputs()), 2)
Example #4
Source File: test_install_lib.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_finalize_options(self): dist = self.create_dist()[1] cmd = install_lib(dist) cmd.finalize_options() self.assertEqual(cmd.compile, 1) self.assertEqual(cmd.optimize, 0) # optimize must be 0, 1, or 2 cmd.optimize = 'foo' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '4' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '2' cmd.finalize_options() self.assertEqual(cmd.optimize, 2)
Example #5
Source File: test_install_lib.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_finalize_options(self): pkg_dir, dist = self.create_dist() cmd = install_lib(dist) cmd.finalize_options() self.assertEqual(cmd.compile, 1) self.assertEqual(cmd.optimize, 0) # optimize must be 0, 1, or 2 cmd.optimize = 'foo' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '4' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '2' cmd.finalize_options() self.assertEqual(cmd.optimize, 2)
Example #6
Source File: test_install_lib.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_get_outputs(self): project_dir, dist = self.create_dist() os.chdir(project_dir) os.mkdir('spam') cmd = install_lib(dist) # setting up a dist environment cmd.compile = cmd.optimize = 1 cmd.install_dir = self.mkdtemp() f = os.path.join(project_dir, 'spam', '__init__.py') self.write_file(f, '# python package') cmd.distribution.ext_modules = [Extension('foo', ['xxx'])] cmd.distribution.packages = ['spam'] cmd.distribution.script_name = 'setup.py' # get_outputs should return 4 elements: spam/__init__.py and .pyc, # foo.import-tag-abiflags.so / foo.pyd outputs = cmd.get_outputs() self.assertEqual(len(outputs), 4, outputs)
Example #7
Source File: test_install_lib.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_get_inputs(self): project_dir, dist = self.create_dist() os.chdir(project_dir) os.mkdir('spam') cmd = install_lib(dist) # setting up a dist environment cmd.compile = cmd.optimize = 1 cmd.install_dir = self.mkdtemp() f = os.path.join(project_dir, 'spam', '__init__.py') self.write_file(f, '# python package') cmd.distribution.ext_modules = [Extension('foo', ['xxx'])] cmd.distribution.packages = ['spam'] cmd.distribution.script_name = 'setup.py' # get_inputs should return 2 elements: spam/__init__.py and # foo.import-tag-abiflags.so / foo.pyd inputs = cmd.get_inputs() self.assertEqual(len(inputs), 2, inputs)
Example #8
Source File: test_install_lib.py From Computable with MIT License | 6 votes |
def test_get_outputs(self): pkg_dir, dist = self.create_dist() cmd = install_lib(dist) # setting up a dist environment cmd.compile = cmd.optimize = 1 cmd.install_dir = pkg_dir f = os.path.join(pkg_dir, 'foo.py') self.write_file(f, '# python file') cmd.distribution.py_modules = [pkg_dir] cmd.distribution.ext_modules = [Extension('foo', ['xxx'])] cmd.distribution.packages = [pkg_dir] cmd.distribution.script_name = 'setup.py' # get_output should return 4 elements self.assertTrue(len(cmd.get_outputs()) >= 2)
Example #9
Source File: test_install_lib.py From Imogen with MIT License | 6 votes |
def test_finalize_options(self): dist = self.create_dist()[1] cmd = install_lib(dist) cmd.finalize_options() self.assertEqual(cmd.compile, 1) self.assertEqual(cmd.optimize, 0) # optimize must be 0, 1, or 2 cmd.optimize = 'foo' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '4' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '2' cmd.finalize_options() self.assertEqual(cmd.optimize, 2)
Example #10
Source File: test_install_lib.py From Computable with MIT License | 6 votes |
def test_get_inputs(self): pkg_dir, dist = self.create_dist() cmd = install_lib(dist) # setting up a dist environment cmd.compile = cmd.optimize = 1 cmd.install_dir = pkg_dir f = os.path.join(pkg_dir, 'foo.py') self.write_file(f, '# python file') cmd.distribution.py_modules = [pkg_dir] cmd.distribution.ext_modules = [Extension('foo', ['xxx'])] cmd.distribution.packages = [pkg_dir] cmd.distribution.script_name = 'setup.py' # get_input should return 2 elements self.assertEqual(len(cmd.get_inputs()), 2)
Example #11
Source File: test_install_lib.py From Imogen with MIT License | 6 votes |
def test_get_outputs(self): project_dir, dist = self.create_dist() os.chdir(project_dir) os.mkdir('spam') cmd = install_lib(dist) # setting up a dist environment cmd.compile = cmd.optimize = 1 cmd.install_dir = self.mkdtemp() f = os.path.join(project_dir, 'spam', '__init__.py') self.write_file(f, '# python package') cmd.distribution.ext_modules = [Extension('foo', ['xxx'])] cmd.distribution.packages = ['spam'] cmd.distribution.script_name = 'setup.py' # get_outputs should return 4 elements: spam/__init__.py and .pyc, # foo.import-tag-abiflags.so / foo.pyd outputs = cmd.get_outputs() self.assertEqual(len(outputs), 4, outputs)
Example #12
Source File: test_install_lib.py From Imogen with MIT License | 6 votes |
def test_dont_write_bytecode(self): # makes sure byte_compile is not used dist = self.create_dist()[1] cmd = install_lib(dist) cmd.compile = 1 cmd.optimize = 1 old_dont_write_bytecode = sys.dont_write_bytecode sys.dont_write_bytecode = True try: cmd.byte_compile([]) finally: sys.dont_write_bytecode = old_dont_write_bytecode self.assertIn('byte-compiling is disabled', self.logs[0][1] % self.logs[0][2])
Example #13
Source File: test_install_lib.py From Computable with MIT License | 6 votes |
def test_finalize_options(self): pkg_dir, dist = self.create_dist() cmd = install_lib(dist) cmd.finalize_options() self.assertEqual(cmd.compile, 1) self.assertEqual(cmd.optimize, 0) # optimize must be 0, 1, or 2 cmd.optimize = 'foo' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '4' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '2' cmd.finalize_options() self.assertEqual(cmd.optimize, 2)
Example #14
Source File: test_install_lib.py From oss-ftp with MIT License | 6 votes |
def test_finalize_options(self): pkg_dir, dist = self.create_dist() cmd = install_lib(dist) cmd.finalize_options() self.assertEqual(cmd.compile, 1) self.assertEqual(cmd.optimize, 0) # optimize must be 0, 1, or 2 cmd.optimize = 'foo' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '4' self.assertRaises(DistutilsOptionError, cmd.finalize_options) cmd.optimize = '2' cmd.finalize_options() self.assertEqual(cmd.optimize, 2)
Example #15
Source File: test_install_lib.py From oss-ftp with MIT License | 6 votes |
def test_get_inputs(self): pkg_dir, dist = self.create_dist() cmd = install_lib(dist) # setting up a dist environment cmd.compile = cmd.optimize = 1 cmd.install_dir = pkg_dir f = os.path.join(pkg_dir, 'foo.py') self.write_file(f, '# python file') cmd.distribution.py_modules = [pkg_dir] cmd.distribution.ext_modules = [Extension('foo', ['xxx'])] cmd.distribution.packages = [pkg_dir] cmd.distribution.script_name = 'setup.py' # get_input should return 2 elements self.assertEqual(len(cmd.get_inputs()), 2)
Example #16
Source File: install_lib.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def _all_packages(pkg_name): """ >>> list(install_lib._all_packages('foo.bar.baz')) ['foo.bar.baz', 'foo.bar', 'foo'] """ while pkg_name: yield pkg_name pkg_name, sep, child = pkg_name.rpartition('.')
Example #17
Source File: install_lib.py From pex with Apache License 2.0 | 5 votes |
def copy_tree( self, infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1 ): assert preserve_mode and preserve_times and not preserve_symlinks exclude = self.get_exclusions() if not exclude: return orig.install_lib.copy_tree(self, infile, outfile) # Exclude namespace package __init__.py* files from the output if "__PEX_UNVENDORED__" in __import__("os").environ: from setuptools.archive_util import unpack_directory # vendor:skip else: from pex.third_party.setuptools.archive_util import unpack_directory from distutils import log outfiles = [] def pf(src, dst): if dst in exclude: log.warn("Skipping installation of %s (namespace package)", dst) return False log.info("copying %s -> %s", src, os.path.dirname(dst)) outfiles.append(dst) return dst unpack_directory(infile, outfile, pf) return outfiles
Example #18
Source File: install_lib.py From pex with Apache License 2.0 | 5 votes |
def get_outputs(self): outputs = orig.install_lib.get_outputs(self) exclude = self.get_exclusions() if exclude: return [f for f in outputs if f not in exclude] return outputs
Example #19
Source File: install_lib.py From deepWordBug with Apache License 2.0 | 5 votes |
def _all_packages(pkg_name): """ >>> list(install_lib._all_packages('foo.bar.baz')) ['foo.bar.baz', 'foo.bar', 'foo'] """ while pkg_name: yield pkg_name pkg_name, sep, child = pkg_name.rpartition('.')
Example #20
Source File: install_lib.py From scylla with Apache License 2.0 | 5 votes |
def get_outputs(self): outputs = orig.install_lib.get_outputs(self) exclude = self.get_exclusions() if exclude: return [f for f in outputs if f not in exclude] return outputs
Example #21
Source File: install_lib.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def copy_tree( self, infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1 ): assert preserve_mode and preserve_times and not preserve_symlinks exclude = self.get_exclusions() if not exclude: return orig.install_lib.copy_tree(self, infile, outfile) # Exclude namespace package __init__.py* files from the output from setuptools.archive_util import unpack_directory from distutils import log outfiles = [] def pf(src, dst): if dst in exclude: log.warn("Skipping installation of %s (namespace package)", dst) return False log.info("copying %s -> %s", src, os.path.dirname(dst)) outfiles.append(dst) return dst unpack_directory(infile, outfile, pf) return outfiles
Example #22
Source File: install_lib.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def get_outputs(self): outputs = orig.install_lib.get_outputs(self) exclude = self.get_exclusions() if exclude: return [f for f in outputs if f not in exclude] return outputs
Example #23
Source File: install_lib.py From pex with Apache License 2.0 | 5 votes |
def _all_packages(pkg_name): """ >>> list(install_lib._all_packages('foo.bar.baz')) ['foo.bar.baz', 'foo.bar', 'foo'] """ while pkg_name: yield pkg_name pkg_name, sep, child = pkg_name.rpartition('.')
Example #24
Source File: install_lib.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def get_outputs(self): outputs = orig.install_lib.get_outputs(self) exclude = self.get_exclusions() if exclude: return [f for f in outputs if f not in exclude] return outputs
Example #25
Source File: install_lib.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def copy_tree( self, infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1 ): assert preserve_mode and preserve_times and not preserve_symlinks exclude = self.get_exclusions() if not exclude: return orig.install_lib.copy_tree(self, infile, outfile) # Exclude namespace package __init__.py* files from the output from setuptools.archive_util import unpack_directory from distutils import log outfiles = [] def pf(src, dst): if dst in exclude: log.warn("Skipping installation of %s (namespace package)", dst) return False log.info("copying %s -> %s", src, os.path.dirname(dst)) outfiles.append(dst) return dst unpack_directory(infile, outfile, pf) return outfiles
Example #26
Source File: install_lib.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def _all_packages(pkg_name): """ >>> list(install_lib._all_packages('foo.bar.baz')) ['foo.bar.baz', 'foo.bar', 'foo'] """ while pkg_name: yield pkg_name pkg_name, sep, child = pkg_name.rpartition('.')
Example #27
Source File: install_lib.py From anpr with Creative Commons Attribution 4.0 International | 5 votes |
def get_outputs(self): outputs = orig.install_lib.get_outputs(self) exclude = self.get_exclusions() if exclude: return [f for f in outputs if f not in exclude] return outputs
Example #28
Source File: install_lib.py From anpr with Creative Commons Attribution 4.0 International | 5 votes |
def copy_tree( self, infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1 ): assert preserve_mode and preserve_times and not preserve_symlinks exclude = self.get_exclusions() if not exclude: return orig.install_lib.copy_tree(self, infile, outfile) # Exclude namespace package __init__.py* files from the output from setuptools.archive_util import unpack_directory from distutils import log outfiles = [] def pf(src, dst): if dst in exclude: log.warn("Skipping installation of %s (namespace package)", dst) return False log.info("copying %s -> %s", src, os.path.dirname(dst)) outfiles.append(dst) return dst unpack_directory(infile, outfile, pf) return outfiles
Example #29
Source File: install_lib.py From anpr with Creative Commons Attribution 4.0 International | 5 votes |
def _all_packages(pkg_name): """ >>> list(install_lib._all_packages('foo.bar.baz')) ['foo.bar.baz', 'foo.bar', 'foo'] """ while pkg_name: yield pkg_name pkg_name, sep, child = pkg_name.rpartition('.')
Example #30
Source File: test_install_lib.py From oss-ftp with MIT License | 5 votes |
def _setup_byte_compile(self): pkg_dir, dist = self.create_dist() cmd = install_lib(dist) cmd.compile = cmd.optimize = 1 f = os.path.join(pkg_dir, 'foo.py') self.write_file(f, '# python file') cmd.byte_compile([f]) return pkg_dir