cinap_lenrekadd hg and python4bb9e2215 years agoHistory
607 lines · 22.8 KB · Python
RawDownload
     def run (self):         # Obviously have to build before we can install        if not self.skip_build:            self.run_command('build')         # Run all sub-commands (at least those that need to be run)        for cmd_name in self.get_sub_commands():            self.run_command(cmd_name)         if self.path_file:            self.create_path_file()         # write list of installed files, if requested.        if self.record:            outputs = self.get_outputs()            if self.root:               # strip any package prefix                root_len = len(self.root)                for counter in xrange(len(outputs)):                    outputs[counter] = outputs[counter][root_len:]            self.execute(write_file,                         (self.record, outputs),                         "writing list of installed files to '%s'" %                         self.record)         sys_path = map(os.path.normpath, sys.path)        sys_path = map(os.path.normcase, sys_path)        install_lib = os.path.normcase(os.path.normpath(self.install_lib))        if (self.warn_dir and            not (self.path_file and self.install_path_file) and            install_lib not in sys_path):            log.debug(("modules installed to '%s', which is not in "                       "Python's module search path (sys.path) -- "                       "you'll have to change the search path yourself"),                       self.install_lib)     # run ()     def create_path_file (self):        filename = os.path.join(self.install_libbase,                                self.path_file + ".pth")        if self.install_path_file:            self.execute(write_file,                         (filename, [self.extra_dirs]),                         "creating %s" % filename)        else:            self.warn("path file '%s' not created" % filename)      # -- Reporting methods ---------------------------------------------     def get_outputs (self):        # Assemble the outputs of all the sub-commands.        outputs = []        for cmd_name in self.get_sub_commands():            cmd = self.get_finalized_command(cmd_name)            # Add the contents of cmd.get_outputs(), ensuring            # that outputs doesn't contain duplicate entries            for filename in cmd.get_outputs():                if filename not in outputs:                    outputs.append(filename)         if self.path_file and self.install_path_file:            outputs.append(os.path.join(self.install_libbase,                                        self.path_file + ".pth"))         return outputs     def get_inputs (self):        # XXX gee, this looks familiar ;-(        inputs = []        for cmd_name in self.get_sub_commands():            cmd = self.get_finalized_command(cmd_name)            inputs.extend(cmd.get_inputs())         return inputs      # -- Predicates for sub-command list -------------------------------     def has_lib (self):        """Return true if the current distribution has any Python        modules to install."""        return (self.distribution.has_pure_modules() or                self.distribution.has_ext_modules())     def has_headers (self):        return self.distribution.has_headers()     def has_scripts (self):        return self.distribution.has_scripts()     def has_data (self):        return self.distribution.has_data_files()      # 'sub_commands': a list of commands this command might have to run to    # get its work done.  See cmd.py for more info.    sub_commands = [('install_lib',     has_lib),                    ('install_headers', has_headers),                    ('install_scripts', has_scripts),                    ('install_data',    has_data),                    ('install_egg_info', lambda self:True),                   ] # class install

Lines 501–607 of 607. Previous lines