Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
setup.PyBuildInstallLib Class Reference
Inheritance diagram for setup.PyBuildInstallLib:
Inheritance graph
[legend]
Collaboration diagram for setup.PyBuildInstallLib:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def install
def set_file_modes
def set_dir_modes
def is_chmod_supported
def initialize_options
def finalize_options
def run
def build
def byte_compile
def get_outputs
def get_inputs

Public Attributes

 install_dir
 build_dir
 force
 compile
 optimize
 skip_build

Static Public Attributes

tuple so_ext = sysconfig.get_config_var("SO")
string description = "install all Python modules (extensions and pure Python)"
list user_options
list boolean_options = ['force', 'compile', 'skip-build']
dictionary negative_opt = {'no-compile' : 'compile'}

Detailed Description

Definition at line 1783 of file setup.py.


Member Function Documentation

Definition at line 101 of file install_lib.py.

00101 
00102     def build(self):
00103         if not self.skip_build:
00104             if self.distribution.has_pure_modules():
00105                 self.run_command('build_py')
00106             if self.distribution.has_ext_modules():
00107                 self.run_command('build_ext')

Here is the call graph for this function:

Here is the caller graph for this function:

def distutils.command.install_lib.install_lib.byte_compile (   self,
  files 
) [inherited]

Definition at line 117 of file install_lib.py.

00117 
00118     def byte_compile(self, files):
00119         if sys.dont_write_bytecode:
00120             self.warn('byte-compiling is disabled, skipping.')
00121             return
00122 
00123         from distutils.util import byte_compile
00124 
00125         # Get the "--root" directory supplied to the "install" command,
00126         # and use it as a prefix to strip off the purported filename
00127         # encoded in bytecode files.  This is far from complete, but it
00128         # should at least generate usable bytecode in RPM distributions.
00129         install_root = self.get_finalized_command('install').root
00130 
00131         if self.compile:
00132             byte_compile(files, optimize=0,
00133                          force=self.force, prefix=install_root,
00134                          dry_run=self.dry_run)
00135         if self.optimize > 0:
00136             byte_compile(files, optimize=self.optimize,
00137                          force=self.force, prefix=install_root,
00138                          verbose=self.verbose, dry_run=self.dry_run)
00139 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 59 of file install_lib.py.

00059 
00060     def finalize_options(self):
00061         # Get all the information we need to install pure Python modules
00062         # from the umbrella 'install' command -- build (source) directory,
00063         # install (target) directory, and whether to compile .py files.
00064         self.set_undefined_options('install',
00065                                    ('build_lib', 'build_dir'),
00066                                    ('install_lib', 'install_dir'),
00067                                    ('force', 'force'),
00068                                    ('compile', 'compile'),
00069                                    ('optimize', 'optimize'),
00070                                    ('skip_build', 'skip_build'),
00071                                   )
00072 
00073         if self.compile is None:
00074             self.compile = True
00075         if self.optimize is None:
00076             self.optimize = False
00077 
00078         if not isinstance(self.optimize, int):
00079             try:
00080                 self.optimize = int(self.optimize)
00081                 if self.optimize not in (0, 1, 2):
00082                     raise AssertionError
00083             except (ValueError, AssertionError):
00084                 raise DistutilsOptionError("optimize must be 0, 1, or 2")

Here is the call graph for this function:

Here is the caller graph for this function:

Get the list of files that are input to this command, ie. the
files that get installed as they are named in the build tree.
The files in this list correspond one-to-one to the output
filenames returned by 'get_outputs()'.

Definition at line 198 of file install_lib.py.

00198 
00199     def get_inputs(self):
00200         """Get the list of files that are input to this command, ie. the
00201         files that get installed as they are named in the build tree.
00202         The files in this list correspond one-to-one to the output
00203         filenames returned by 'get_outputs()'.
00204         """
00205         inputs = []
00206 
00207         if self.distribution.has_pure_modules():
00208             build_py = self.get_finalized_command('build_py')
00209             inputs.extend(build_py.get_outputs())
00210 
00211         if self.distribution.has_ext_modules():
00212             build_ext = self.get_finalized_command('build_ext')
00213             inputs.extend(build_ext.get_outputs())
00214 
00215         return inputs

Here is the call graph for this function:

Return the list of files that would be installed if this command
were actually run.  Not affected by the "dry-run" flag or whether
modules have actually been built yet.

Definition at line 177 of file install_lib.py.

00177 
00178     def get_outputs(self):
00179         """Return the list of files that would be installed if this command
00180         were actually run.  Not affected by the "dry-run" flag or whether
00181         modules have actually been built yet.
00182         """
00183         pure_outputs = \
00184             self._mutate_outputs(self.distribution.has_pure_modules(),
00185                                  'build_py', 'build_lib',
00186                                  self.install_dir)
00187         if self.compile:
00188             bytecode_outputs = self._bytecode_filenames(pure_outputs)
00189         else:
00190             bytecode_outputs = []
00191 
00192         ext_outputs = \
00193             self._mutate_outputs(self.distribution.has_ext_modules(),
00194                                  'build_ext', 'build_lib',
00195                                  self.install_dir)
00196 
00197         return pure_outputs + bytecode_outputs + ext_outputs

Here is the call graph for this function:

Definition at line 50 of file install_lib.py.

00050 
00051     def initialize_options(self):
00052         # let the 'install' command dictate our installation directory
00053         self.install_dir = None
00054         self.build_dir = None
00055         self.force = 0
00056         self.compile = None
00057         self.optimize = None
00058         self.skip_build = None

Reimplemented from distutils.command.install_lib.install_lib.

Definition at line 1791 of file setup.py.

01791 
01792     def install(self):
01793         outfiles = install_lib.install(self)
01794         self.set_file_modes(outfiles, 0o644, 0o755)
01795         self.set_dir_modes(self.install_dir, 0o755)
01796         return outfiles

Here is the call graph for this function:

Definition at line 1816 of file setup.py.

01816 
01817     def is_chmod_supported(self):
01818         return hasattr(os, 'chmod')

Here is the caller graph for this function:

Definition at line 85 of file install_lib.py.

00085 
00086     def run(self):
00087         # Make sure we have built everything we need first
00088         self.build()
00089 
00090         # Install everything: simply dump the entire contents of the build
00091         # directory to the installation directory (that's the beauty of
00092         # having a build directory!)
00093         outfiles = self.install()
00094 
00095         # (Optionally) compile .py to .pyc
00096         if outfiles is not None and self.distribution.has_pure_modules():
00097             self.byte_compile(outfiles)

Here is the call graph for this function:

Here is the caller graph for this function:

def setup.PyBuildInstallLib.set_dir_modes (   self,
  dirname,
  mode 
)

Definition at line 1808 of file setup.py.

01808 
01809     def set_dir_modes(self, dirname, mode):
01810         if not self.is_chmod_supported(): return
01811         for dirpath, dirnames, fnames in os.walk(dirname):
01812             if os.path.islink(dirpath):
01813                 continue
01814             log.info("changing mode of %s to %o", dirpath, mode)
01815             if not self.dry_run: os.chmod(dirpath, mode)

Here is the call graph for this function:

Here is the caller graph for this function:

def setup.PyBuildInstallLib.set_file_modes (   self,
  files,
  defaultMode,
  sharedLibMode 
)

Definition at line 1797 of file setup.py.

01797 
01798     def set_file_modes(self, files, defaultMode, sharedLibMode):
01799         if not self.is_chmod_supported(): return
01800         if not files: return
01801 
01802         for filename in files:
01803             if os.path.islink(filename): continue
01804             mode = defaultMode
01805             if filename.endswith(self.so_ext): mode = sharedLibMode
01806             log.info("changing mode of %s to %o", filename, mode)
01807             if not self.dry_run: os.chmod(filename, mode)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 47 of file install_lib.py.

Definition at line 53 of file install_lib.py.

Definition at line 55 of file install_lib.py.

string distutils.command.install_lib.install_lib.description = "install all Python modules (extensions and pure Python)" [static, inherited]

Definition at line 18 of file install_lib.py.

Definition at line 54 of file install_lib.py.

Definition at line 52 of file install_lib.py.

Definition at line 48 of file install_lib.py.

Definition at line 56 of file install_lib.py.

Definition at line 57 of file install_lib.py.

Definition at line 1789 of file setup.py.

Initial value:
[
        ('install-dir=', 'd', "directory to install to"),
        ('build-dir=','b', "build directory (where to install from)"),
        ('force', 'f', "force installation (overwrite existing files)"),
        ('compile', 'c', "compile .py to .pyc [default]"),
        ('no-compile', None, "don't compile .py files"),
        ('optimize=', 'O',
         "also compile with optimization: -O1 for \"python -O\", "
         "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),
        ('skip-build', None, "skip the build steps"),
        ]

Definition at line 35 of file install_lib.py.


The documentation for this class was generated from the following file: