Python setuptools.command.install.install 模块,run() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用setuptools.command.install.install.run()

项目:eSSP    作者:Minege    | 项目源码 | 文件源码
def run(self):
        # run original build code
        build.run(self)

        cmd = [
            'make',
        ]

        def compile():
            call(cmd, cwd=os.path.join(BASEPATH, "_eSSP"))

        self.execute(compile, [], 'Compiling library')

        if not self.dry_run:
            self.copy_file(os.path.join(BASEPATH, "_eSSP", "libessp.so"),
                           os.path.join(self.build_lib, "eSSP"))
项目:rivalcfg    作者:flozz    | 项目源码 | 文件源码
def run(self):
        _install.run(self)
        print("Installing udev rules...")
        if not os.path.isdir("/etc/udev/rules.d"):
            print("WARNING: udev rules have not been installed (/etc/udev/rules.d is not a directory)")
            return
        try:
            shutil.copy("./rivalcfg/data/99-steelseries-rival.rules", "/etc/udev/rules.d/")
        except IOError:
            print("WARNING: udev rules have not been installed (permission denied)")
            return
        try:
            subprocess.call(["udevadm", "trigger"])
        except OSError:
            print("WARNING: unable to update udev rules, please run the 'udevadm trigger' command")
            return
        print("Done!")
项目:PyStanfordNLP    作者:banyh    | 项目源码 | 文件源码
def run(self):
        install.run(self)
        sys.path.reverse()
        # ----------- install segmenter ------------
        import stanford_segmenter
        pwd = stanford_segmenter.__path__[0]
        if not isdir(join(pwd, 'seg')):
            print('Start downloading stanford-segmenter-2015-12-09.zip...')
            urlretrieve('http://nlp.stanford.edu/software/stanford-segmenter-2015-12-09.zip', 'seg.zip', report)
            with zipfile.ZipFile('seg.zip', 'r') as z:
                z.extractall(pwd)
            rename(join(pwd, 'stanford-segmenter-2015-12-09'), join(pwd, 'seg'))
            unlink('seg.zip')
        # ----------- install postagger ------------
        import stanford_postagger
        pwd = stanford_postagger.__path__[0]
        if not isdir(join(pwd, 'pos')):
            print('Start downloading stanford-postagger-full-2015-12-09.zip...')
            urlretrieve('http://nlp.stanford.edu/software/stanford-postagger-full-2015-12-09.zip', 'pos.zip', report)
            with zipfile.ZipFile('pos.zip', 'r') as z:
                z.extractall(pwd)
            rename(join(pwd, 'stanford-postagger-full-2015-12-09'), join(pwd, 'pos'))
            unlink('pos.zip')
项目:WORLD4py    作者:yamachu    | 项目源码 | 文件源码
def run(self):
        install.run(self)

        platform = self._get_platform()
        library_full_path = self._get_install_full_path(
            self._get_base_install_path(),
            self._LIBRARY_NAME[platform][1])

        get_latest_request = Request('https://github.com/yamachu/World/releases/latest',
                                     headers={'Accept': 'application/json'})
        get_latest_response = urlopen(get_latest_request)
        response_str = get_latest_response.read().decode('utf-8')
        response_json = json.loads(response_str)
        latest_version = response_json['tag_name']

        urlretrieve("{}/{}/{}".format(
            self._DOWNLOAD_BASE_URL,
            latest_version,
            self._LIBRARY_NAME[platform][0]), library_full_path)
项目:MLBox    作者:AxeldeRomblay    | 项目源码 | 文件源码
def run(self):
        # Install all requirements
        failed = []

        for req in requirements:
            if pip.main(["install", req]) == 1:
                failed.append(req)

        if len(failed) > 0:
            print("")
            print("Error installing the following packages:")
            print(str(failed))
            print("Please install them manually")
            print("")
            raise OSError("Aborting")

        # install MlBox
        install.run(self)
项目:virt-bootstrap    作者:virt-manager    | 项目源码 | 文件源码
def run(self):
        if not os.path.exists("build"):
            os.mkdir("build")

        if os.path.exists(".git"):
            try:
                self.gen_authors()
                self.gen_changelog()

                sdist.run(self)

            finally:
                files = ["AUTHORS",
                         "ChangeLog"]
                for item in files:
                    if os.path.exists(item):
                        os.unlink(item)
        else:
            sdist.run(self)
项目:GraphLearn    作者:smautner    | 项目源码 | 文件源码
def update_version_py():
    if not os.path.isdir(".git"):
        print("This does not appear to be a Git repository.")
        return
    try:
        p = subprocess.Popen(["git", "describe",
                              "--tags", "--always"],
                             stdout=subprocess.PIPE)
    except EnvironmentError:
        print("unable to run git, leaving eden/_version.py alone")
        return
    stdout = p.communicate()[0]
    if p.returncode != 0:
        print("unable to run git, leaving eden/_version.py alone")
        return
    ver = stdout.strip()
    ver = str(int(ver,16)) # pypi doesnt like base 16
    f = open("graphlearn/_version.py", "w")
    f.write(VERSION_PY % ver)
    f.close()
    print("set graphlearn/_version.py to '%s'" % ver)
项目:nautilus-terminal    作者:flozz    | 项目源码 | 文件源码
def run(self):
        _install.run(self)

        # Do what distutils install_data used to do... *sigh*
        # Despite what the setuptools docs say, the omission of this
        # in setuptools is a bug, not a feature.
        print("== Installing Nautilus Python extension...")
        src_file = "nautilus_terminal/nautilus_terminal_extension.py"
        dst_dir = os.path.join(self.install_data, "share/nautilus-python/extensions")
        self.mkpath(dst_dir)
        dst_file = os.path.join(dst_dir, os.path.basename(src_file))
        self.copy_file(src_file, dst_file)
        print("== Done!")

        print("== Installing GSettings Schema")
        src_file = "./nautilus_terminal/schemas/org.flozz.nautilus-terminal.gschema.xml"
        dst_dir = os.path.join(self.install_data, "share/glib-2.0/schemas")
        self.mkpath(dst_dir)
        dst_file = os.path.join(dst_dir, os.path.basename(src_file))
        self.copy_file(src_file, dst_file)
        print("== Done! Run 'glib-compile-schemas /usr/share/glib-2.0/schemas/' for a global installation to compile the schema.")
项目:aioweb    作者:kreopt    | 项目源码 | 文件源码
def run(self):
        install.run(self)

        WYRM_PATH = os.path.join(self.install_scripts, 'wyrm')
        AIOWEB_SHARE = os.path.join(self.install_base, 'share/aioweb/')

        print("creating %s" % WYRM_PATH)

        if os.path.exists(WYRM_PATH):
            os.unlink(WYRM_PATH)

        shutil.copy2("bin/wyrm", self.install_scripts)

        print("coping generators")

        if os.path.exists(AIOWEB_SHARE):
            shutil.rmtree(AIOWEB_SHARE)
        os.mkdir(AIOWEB_SHARE)

        shutil.copytree("generators", os.path.join(AIOWEB_SHARE, "generators"))
项目:transvar    作者:zwdzwd    | 项目源码 | 文件源码
def run(self):

        # run original build code
        build.run(self)

        # build samtools
        build_path = os.path.abspath(self.build_temp)

        cmd = ['make', '-C', 'external/samtools']

        def compile():
            subprocess.check_call(cmd)

        self.execute(compile, [], 'Compile samtools')

        def compile_htslib():
            subprocess.check_call(['./configure'], cwd='external/samtools/htslib-1.2.1')
            subprocess.check_call(['make'], cwd='external/samtools/htslib-1.2.1')

        self.execute(compile_htslib, [], 'Compile htslib')
项目:combirepo    作者:Samsung    | 项目源码 | 文件源码
def run(self):
        install.run(self)

        instcmd = self.get_finalized_command('install')
        root = instcmd.root
        prefix = path.abspath(get_config_vars('prefix')[0])
        data_dir = path.abspath(check_data_dir())
        man_file = path.join(data_dir, "combirepo.1")

        if not path.exists(man_file):
            self.run_command('build_manpage')
        man_path = path.abspath('{0}/{1}/share/man/man1/'.format(root, prefix))
        if not path.exists(man_path):
            makedirs(man_path)

        print "Installing man page into {0}".format(man_path)
        cmd = "bash -c 'gzip {0} \
               && install -m 0644 {0}.gz {1}/'".format(man_file, man_path)
        args = shlex.split(cmd)
        call(args)
项目:alicloud-duplicity    作者:aliyun    | 项目源码 | 文件源码
def run(self):
        # Make sure all modules are ready
        build_cmd = self.get_finalized_command("build_py")
        build_cmd.run()
        # And make sure our scripts are ready
        build_scripts_cmd = self.get_finalized_command("build_scripts")
        build_scripts_cmd.run()

        # make symlinks for test data
        if build_cmd.build_lib != top_dir:
            for path in ['testfiles.tar.gz', 'gnupg']:
                src = os.path.join(top_dir, 'testing', path)
                target = os.path.join(build_cmd.build_lib, 'testing', path)
                try:
                    os.symlink(src, target)
                except Exception:
                    pass

        os.environ['PATH'] = "%s:%s" % (
            os.path.abspath(build_scripts_cmd.build_dir),
            os.environ.get('PATH'))

        test.run(self)
项目:alicloud-duplicity    作者:aliyun    | 项目源码 | 文件源码
def run(self):
        # Normally, install will call build().  But we want to delete the
        # testing dir between building and installing.  So we manually build
        # and mark ourselves to skip building when we run() for real.
        self.run_command('build')
        self.skip_build = True

        # This should always be true, but just to make sure!
        if self.build_lib != top_dir:
            testing_dir = os.path.join(self.build_lib, 'testing')
            os.system("rm -rf %s" % testing_dir)

        install.run(self)


# TODO: move logic from dist/makedist inline
项目:ugali    作者:DarkEnergySurvey    | 项目源码 | 文件源码
def run(self):
        if self.dry_run:
            print("skipping data install")
            return

        if (self.survey is None) and (self.model is None):
            self.tarball = self._tarball
            self.dirname = self._dirname
            super(IsochroneCommand,self).run()
            return

        for survey in self.surveys:
            for model in self.models:
                self.tarball = "ugali-%s-%s.tar.gz"%(survey,model)
                self.dirname = "isochrones/%s/%s"%(survey,model)
                super(IsochroneCommand,self).run()
项目:StructOut    作者:smautner    | 项目源码 | 文件源码
def update_version_py():
    if not os.path.isdir(".git"):
        print("This does not appear to be a Git repository.")
        return
    try:
        #p = subprocess.Popen(["git", "describe","--tags", "--always"],
        #        stdout=subprocess.PIPE)
        p = subprocess.Popen("git rev-list HEAD --count".split(),
                stdout=subprocess.PIPE)


    except EnvironmentError:
        print("unable to run git, leaving structout/_version.py alone")
        return
    stdout = p.communicate()[0]
    if p.returncode != 0:
        print("unable to run git, leaving structout/_version.py alone")
        return
    ver = "0.0."+stdout.strip()
    #ver = str(int(ver,16)) # pypi doesnt like base 16
    f = open("structout/_version.py", "w")
    f.write(VERSION_PY % ver)
    f.close()
    print("set structout/_version.py to '%s'" % ver)
项目:lid    作者:codeauroraforum    | 项目源码 | 文件源码
def run(self):
        # Perform original install steps
        install.run(self)

        # Perform custom install steps
        from license_identifier.license_identifier import LicenseIdentifier

        license_dir = os.path.join(
            self.install_lib, 'license_identifier/data/license_dir'
        )
        pickle_file_path = os.path.join(
            self.install_lib,
            'license_identifier/data/license_n_gram_lib.pickle'
        )

        LicenseIdentifier(license_dir=license_dir,
                          pickle_file_path=pickle_file_path)
项目:ACedIt    作者:coderick14    | 项目源码 | 文件源码
def run(self):

        default_site = 'codeforces'
        cache_dir = os.path.join(os.path.expanduser('~'), '.cache', 'ACedIt')

        from main import supported_sites

        for site in supported_sites:
                # create cache directory structure
            if not os.path.isdir(os.path.join(cache_dir, site)):
                os.makedirs(os.path.join(cache_dir, site))

        data = {'default_site': default_site.strip(
        ), 'default_contest': None, 'cachedir': cache_dir}
        with open(os.path.join(cache_dir, 'constants.json'), 'w') as f:
            f.write(json.dumps(data, indent=2))
        install.run(self)
项目:tsaotun    作者:qazbnm456    | 项目源码 | 文件源码
def run(self):
        install.run(self)
        print "Installing auto completion of tsaotun to",
        src = os.path.join(ROOT_DIR, 'completion', 'tsaotun')
        sys = platform.system()
        try:
            if sys == 'Darwin':
                dest = os.path.join(
                    os.popen('brew --prefix').read()[:-1], 'etc', 'bash_completion.d', 'tsaotun')
                print dest
                shutil.copy(src, dest)
            elif sys == 'Linux':
                dest = os.path.join(
                    '/etc', 'bash_completion.d', 'tsaotun')
                print dest
                shutil.copy(src, dest)
            else:  # Windows, etc.
                print "... \n Warning: {} is currently not supported. Skipped.".format(sys)
        except IOError:
            print "Permission denied: You probably want to copy '{}' to '{}' manually.".format(src, dest)
        print "Tsaotun is installed successfully."
项目:ThreatPrep    作者:ThreatResponse    | 项目源码 | 文件源码
def run(self):
        self.run_command('build')
        _install.run(self)
项目:eSSP    作者:Minege    | 项目源码 | 文件源码
def run(self):
        # run original install code
        install.run(self)

        # install library
        self.copy_tree(self.build_lib, self.install_lib)
项目:aniwall    作者:worron    | 项目源码 | 文件源码
def run(self):
        _pre_install()
        install.run(self)
        # FIXME: why egg missed without manual install?
        install.do_egg_install(self)
项目:aniwall    作者:worron    | 项目源码 | 文件源码
def run(self):
        _pre_install()
        develop.run(self)
项目:girder_worker    作者:girder    | 项目源码 | 文件源码
def run(self, *args, **kwargs):
        install.run(self, *args, **kwargs)

        distcfg = os.path.join('girder_worker', 'worker.dist.cfg')
        localcfg = os.path.join('girder_worker', 'worker.local.cfg')
        if not os.path.isfile(localcfg):
            print('Creating worker.local.cfg')
            shutil.copyfile(distcfg, localcfg)
项目:ave    作者:sonyxperiadev    | 项目源码 | 文件源码
def run(cmd):
    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    out, err = proc.communicate()
    if proc.returncode:
        print(err)
        sys.exit(1)
    else:
        return out
项目:ave    作者:sonyxperiadev    | 项目源码 | 文件源码
def initial_ave():
    # create /etc/ave/user if it doesn't exist
    import ave.config
    try:
        user = ave.config.create_etc()
    except Exception, e:
        print('ERROR: Installation failed: %s' % e)
        return 1

    # become the run-as user before checking/generating config files
    try:
        import ave.persona
        home = ave.persona.become_user(user)
    except Exception, e:
        print('ERROR: Could not become user %s' % user)
        return 2

    # create the default AVE configuration
    try:
        ave.config.create_default(home)
    except Exception, e:
        print(
            'ERROR: Could not create configuration files for %s: %s'
            % (user, str(e))
        )
        return 3
项目:ave    作者:sonyxperiadev    | 项目源码 | 文件源码
def run(self):
        install.run(self)
        self.execute(post_install, [], msg="Running post install task")


# Get the long description from the README file
项目:ave    作者:sonyxperiadev    | 项目源码 | 文件源码
def build_libfdtx():
    root = here + '/common/src/libfdtx'
    run(['make', '-C', root, 'clean'])
    run(['make', '-C', root, 'libfdtx.so'])
    return 'common/src/libfdtx/libfdtx.so'


# Build Galatea
项目:aws_ir_plugins    作者:ThreatResponse    | 项目源码 | 文件源码
def run(self):
        self.run_command('build')
        _install.run(self)
项目:SwiftKitten    作者:johncsnyder    | 项目源码 | 文件源码
def run(self):
        _install.run(self)
        self.execute(_run_build_tables, (self.install_lib,),
                     msg="Build the lexing/parsing tables")
项目:jack    作者:uclmr    | 项目源码 | 文件源码
def run(self):
        _install.do_egg_install(self)
        spacy_download_en()
        _install.run(self)
项目:jack    作者:uclmr    | 项目源码 | 文件源码
def run(self):
        spacy_download_en()
        _develop.run(self)
项目:tomato    作者:sertansenturk    | 项目源码 | 文件源码
def run(self):
        # download the binaries
        self.execute(self._setup_binaries, (),
                     msg="Downloaded the binaries from tomato_binaries.")

        # install tomato
        _install.run(self)

        # install requirements
        subprocess.call(["pip install -Ur requirements"], shell=True)
项目:jarvis    作者:BastienFaure    | 项目源码 | 文件源码
def run(self):
        develop.run(self)
项目:jarvis    作者:BastienFaure    | 项目源码 | 文件源码
def run(self):
        install.run(self)

# Save version and author to __meta__.py
项目:pyqha    作者:mauropalumbo75    | 项目源码 | 文件源码
def run(self):
        #os.system('')   # add some commands for Cython functions
        build_ext.run(self)
项目:pyqha    作者:mauropalumbo75    | 项目源码 | 文件源码
def run(self):
        #os.system('')   # add some commands for Cython functions
        sdist.run(self)
项目:pyqha    作者:mauropalumbo75    | 项目源码 | 文件源码
def run(self):
        #os.system('')   # add some commands for Cython functions
        install.run(self)
项目:circtools    作者:dieterich-lab    | 项目源码 | 文件源码
def run(self):

        develop.run(self)
项目:gbg    作者:rwbogl    | 项目源码 | 文件源码
def run(self):
        _install.run(self)
        self.execute(_run_build_tables, (self.install_lib,),
                     msg="Build the lexing/parsing tables")
项目:UrbanSearch    作者:urbansearchTUD    | 项目源码 | 文件源码
def run(self):
        load_nltk_data()
        install.run(self)
项目:virt-bootstrap    作者:virt-manager    | 项目源码 | 文件源码
def run(self):
        """
        Post install script
        """
        cmd = [
            'pod2man',
            '--center=Container bootstrapping tool',
            '--name=VIRT-BOOTSTRAP',
            '--release=%s' % virtBootstrap.__version__,
            'man/virt-bootstrap.pod',
            'man/virt-bootstrap.1'
        ]
        if subprocess.call(cmd) != 0:
            raise RuntimeError("Building man pages has failed")
        install.run(self)
项目:virt-bootstrap    作者:virt-manager    | 项目源码 | 文件源码
def run(self):
        """
        Call pycodestyle and pylint here.
        """

        res = 0
        files = ' '.join(["setup.py", "src/virtBootstrap/*.py", "tests/*.py"])
        output_format = "colorized" if sys.stdout.isatty() else "text"

        print(">>> Running pycodestyle ...")
        cmd = "pycodestyle "
        if (subprocess.call(cmd + files, shell=True) != 0):
            res = 1

        print(">>> Running pylint ...")
        args = ""
        if self.errors_only:
            args = "-E"
        cmd = "pylint %s --output-format=%s " % (args, format(output_format))
        if (subprocess.call(cmd + files, shell=True) != 0):
            res = 1

        sys.exit(res)


# SdistCommand is reused from the libvirt python binding (GPLv2+)
项目:mycroft    作者:wpm    | 项目源码 | 文件源码
def run(self):
        check_call("python -m spacy download en".split())
        develop.run(self)
项目:mycroft    作者:wpm    | 项目源码 | 文件源码
def run(self):
        check_call("python -m spacy download en".split())
        install.run(self)
项目:meshpy    作者:BerkeleyAutomation    | 项目源码 | 文件源码
def run(self):
        os.system('sh install_meshrender.sh')
        develop.run(self)
项目:meshpy    作者:BerkeleyAutomation    | 项目源码 | 文件源码
def run(self):
        os.system('sh install_meshrender.sh')
        install.run(self)
项目:integration-prototype    作者:SKA-ScienceDataProcessor    | 项目源码 | 文件源码
def run(self):
        """Overridden method. Runs the build.
        Library directories and include directories are checked here, first.
        """
        # Add the numpy include directory.
        self.include_dirs.insert(0, get_include())

        # Call the base class method.
        build_ext.run(self)
项目:integration-prototype    作者:SKA-ScienceDataProcessor    | 项目源码 | 文件源码
def run(self):
        """Overridden method. Runs the installation."""
        install.run(self)  # Call the base class method.

        # Make sure all Python tasks are executable.
        for file_path in self.get_outputs():
            if 'tasks' in file_path and '.py' in file_path:
                status = os.stat(file_path)
                os.chmod(file_path, status.st_mode | 73)
项目:integration-prototype    作者:SKA-ScienceDataProcessor    | 项目源码 | 文件源码
def run(self):
        self.discover_tests()
        self.test_runner.run(self.test_suite)
        if self.outfile:
            self.outfile.close()
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def run(self):
        install.run(self)