Python setuptools.command.install.install.run() Examples

The following are 30 code examples of setuptools.command.install.install.run(). 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 setuptools.command.install.install , or try the search function .
Example #1
Source File: setup.py    From EDeN with MIT License 7 votes vote down vote up
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 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 = "0.3."+stdout.strip()
    # ver = str(int(ver,16)) # pypi doesnt like base 16
    f = open("eden/_version.py", "w")
    f.write(VERSION_PY % ver)
    f.close()
    print("set eden/_version.py to '%s'" % ver) 
Example #2
Source File: setup.py    From yatsm with MIT License 6 votes vote down vote up
def run(self):
        _clean.run(self)
        if os.path.exists('build'):
            shutil.rmtree('build')
        for dirpath, dirnames, filenames in os.walk('yatsm'):
            for filename in filenames:
                if any(filename.endswith(suffix) for suffix in
                       ('.c', '.so', '.pyd', '.pyc')):
                    os.unlink(os.path.join(dirpath, filename))
                    continue
                if (any(filename.endswith(suffix) for suffix in
                        ('.pkl', '.json')) and
                        os.path.basename(dirpath) == 'pickles'):
                    os.unlink(os.path.join(dirpath, filename))
            for dirname in dirnames:
                if dirname == '__pycache__':
                    shutil.rmtree(os.path.join(dirpath, dirname))


# Create pickles when building 
Example #3
Source File: setup.py    From nautilus-open-any-terminal with GNU General Public License v3.0 6 votes vote down vote up
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_open_any_terminal/open_any_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_open_any_terminal/schemas/com.github.stunkymonkey.nautilus-open-any-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 " + dst_dir + "/' to compile the schema.") 
Example #4
Source File: setup.py    From pycorpora with MIT License 6 votes vote down vote up
def run(self):
        if self.corpora_zip_url is None:
            self.corpora_zip_url = os.environ.get(
                "CORPORA_ZIP_URL",
                "https://github.com/dariusk/corpora/archive/master.zip",
            )
        print("Installing corpora data from " + self.corpora_zip_url)
        mkpath("./corpora-download")
        resp = urlopen(self.corpora_zip_url).read()
        remote = io.BytesIO(resp)
        zf = zipfile.ZipFile(remote, "r")
        zf.extractall("corpora-download")
        try:
            data_dir = glob.glob("./corpora-download/*/data")[0]
        except IndexError:
            raise IndexError(
                "malformed corpora archive: expecting a subdirectory '*/data'")
        copy_tree(data_dir, "pycorpora/data")
        install.run(self) 
Example #5
Source File: setup.py    From pyGenomeTracks with GNU General Public License v3.0 6 votes vote down vote up
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 pygenometracks/_version.py alone")
        return
    stdout = p.communicate()[0]
    if p.returncode != 0:
        print("unable to run git, leaving pygenometracks/_version.py alone")
        return
    ver = stdout.strip()
    f = open(os.path.join("pygenometracks", "_version.py"), "w")
    f.write(VERSION_PY % ver)
    f.close()
    print("set pygenometracks/_version.py to '%s'" % ver) 
Example #6
Source File: setup.py    From HiCExplorer with GNU General Public License v3.0 6 votes vote down vote up
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 hicexplorer/_version.py alone")
        return
    stdout = p.communicate()[0]
    if p.returncode != 0:
        print("unable to run git, leaving hicexplorer/_version.py alone")
        return
    ver = stdout.strip()
    f = open("hicexplorer/_version.py", "w")
    f.write(VERSION_PY % ver)
    f.close()
    print("set hicexplorer/_version.py to '%s'" % ver) 
Example #7
Source File: setup.py    From jack with MIT License 5 votes vote down vote up
def run(self):
        _install.do_egg_install(self)
        spacy_download_en()
        _install.run(self) 
Example #8
Source File: setup.py    From mat2vec with MIT License 5 votes vote down vote up
def run(self):
        for model_file in self._MODEL_FILES:
            file_url = urllib.parse.urljoin(self._MODELS_URL, model_file)
            final_location = os.path.join(self._DOWNLOAD_LOCATION, model_file)
            r = requests.get(file_url, stream=True)

            total_size = int(r.headers.get('content-length', 0))
            if self._file_exists_correct_size(model_file, total_size):
                logging.info("{} already present, skipping download.".format(model_file))
                continue  # If the file is already there, skip downloading it.

            logging.info('Starting download for {}'.format(model_file))
            block_size, wrote = 1024, 0
            with open(final_location, 'wb') as downloaded_file:
                for data in tqdm(r.iter_content(block_size),
                                 total=math.ceil(total_size // block_size),
                                 unit='KB',
                                 unit_scale=True):
                    wrote = wrote + len(data)
                    downloaded_file.write(data)
            if total_size != 0 and wrote != total_size:
                logging.ERROR(
                    "Something went wrong during the download "
                    "of {}, the size of the file is not correct. "
                    "Please retry.".format(model_file))
            else:
                logging.info("{} successfully downloaded.".format(model_file))
        install.run(self) 
Example #9
Source File: setup.py    From scapy-ssl_tls with GNU General Public License v2.0 5 votes vote down vote up
def run(self):
        _install.run(self)
        self.execute(
            _post_install, (self.install_lib,), msg="running post install task") 
Example #10
Source File: setup.py    From hypertools with MIT License 5 votes vote down vote up
def run(self):
        install.run(self)
        output = subprocess.run([sys.executable, '-m', 'pip', 'install', self.github_pkg],
                                stdout=subprocess.PIPE)
        print(output.stdout.decode('utf-8')) 
Example #11
Source File: setup.py    From tick with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def run(self):
        swig_ver = self.extract_swig_version(
            str(subprocess.check_output(['swig', '-version'])))

        if swig_ver < self.swig_min_ver:
            txt = 'SWIG version {0}.{1}.{2} ' \
                  'lower than the required version >= {3}.{4}.{5}. ' \
                  'This will likely cause build errors!'

            warnings.warn(txt.format(*(swig_ver + self.swig_min_ver)))

        self.run_command('build_ext')
        build.run(self) 
Example #12
Source File: setup.py    From yolo_v2 with Apache License 2.0 5 votes vote down vote up
def RunCustomCommand(self, command_list):
        p = subprocess.Popen(
            command_list,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT)
        # Can use communicate(input='y\n'.encode()) if the command run requires
        # some confirmation.
        stdout_data, _ = p.communicate()
        logging.info('Log command output: %s', stdout_data)
        if p.returncode != 0:
            raise RuntimeError('Command %s failed: exit code: %s' %
                            (command_list, p.returncode)) 
Example #13
Source File: setup.py    From keras-bert-ner with MIT License 5 votes vote down vote up
def run(self):
        call(["pip install -r requirements.txt --no-clean"], shell=True)
        install.run(self) 
Example #14
Source File: setup.py    From HiCExplorer with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        # update_version_py()
        self.distribution.metadata.version = get_version()
        return _sdist.run(self)

# Install class to check for external dependencies from OS environment 
Example #15
Source File: setup.py    From HiCExplorer with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        # update_version_py()
        self.distribution.metadata.version = get_version()
        _install.run(self)
        return 
Example #16
Source File: setup.py    From scarecrow with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        if not sys.platform.startswith("linux"):
            print('Your platform {} might not be supported'.format(sys.platform))
        subprocess.call(['./sbin/install_tensorflow_models.sh'])
        #subprocess.call(['./sbin/install_vidgear.sh']) # Switched to vidgear=0.1.8 stable
        install.run(self) 
Example #17
Source File: setup.py    From talon_configs with MIT License 5 votes vote down vote up
def run(self):
        _install.run(self)
        system("pre-commit install") 
Example #18
Source File: setup.py    From symengine.py with MIT License 5 votes vote down vote up
def run(self):
        # can't use super() here because _install is an old style class in 2.7
        _install.run(self)
        self.cmake_install() 
Example #19
Source File: setup.py    From xos with Apache License 2.0 5 votes vote down vote up
def run(self):
        install.run(self)
        for filepath in self.get_outputs():
            if filepath.endswith(
                "chameleon_client/protoc_plugins/gw_gen.py"
            ):
                os.chmod(filepath, 0o777) 
Example #20
Source File: setup.py    From yolo_v2 with Apache License 2.0 5 votes vote down vote up
def run(self):
        self.RunCustomCommand(['apt-get', 'update'])
        self.RunCustomCommand(
            ['apt-get', 'install', '-y', 'python-tk'])
        install.run(self) 
Example #21
Source File: setup.py    From tick with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def run(self):
        self.run_command('makecpptest')
        self.run_command('runcpptest') 
Example #22
Source File: setup.py    From pyGenomeTracks with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        # update_version_py()
        self.distribution.metadata.version = get_version()
        _install.run(self)
        return 
Example #23
Source File: setup.py    From pyGenomeTracks with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        # update_version_py()
        self.distribution.metadata.version = get_version()
        return _sdist.run(self)

# Install class to check for external dependencies from OS environment 
Example #24
Source File: setup.py    From OpenDeep with Apache License 2.0 5 votes vote down vote up
def run(self):
        print("OpenDeep is in alpha and undergoing heavy development. "
              "We recommend using 'python setup.py develop' rather than 'python setup.py install'.")
        mode = None
        while mode not in ['', 'install', 'develop', 'cancel']:
            if mode is not None:
                print("Please try again")
            mode = input("Installation mode: [develop]/install/cancel: ")
        if mode in ['', 'develop']:
            self.distribution.run_command('develop')
        if mode == 'install':
            return install.run(self) 
Example #25
Source File: setup.py    From cutelog with MIT License 5 votes vote down vote up
def run(self):
        try:
            build_qt_resources()
        except Exception as e:
            print('Could not compile the resources.py file due to an exception: "{}"\n'
                  'Aborting build.'.format(e))
            raise
        install.run(self) 
Example #26
Source File: setup.py    From SwiftKitten with MIT License 5 votes vote down vote up
def run(self):
        _install.run(self)
        self.execute(_run_build_tables, (self.install_lib,),
                     msg="Build the lexing/parsing tables") 
Example #27
Source File: setup.py    From tensorboardX with MIT License 5 votes vote down vote up
def run(self):
        compileProtoBuf()
        import os
        os.system("pip install protobuf numpy six")
        install.run(self) 
Example #28
Source File: setup.py    From tensorboardX with MIT License 5 votes vote down vote up
def run(self):
        compileProtoBuf()
        develop.run(self) 
Example #29
Source File: setup.py    From counterblock with MIT License 5 votes vote down vote up
def run(self):
        caller = sys._getframe(2)
        caller_module = caller.f_globals.get('__name__','')
        caller_name = caller.f_code.co_name
        if caller_module == 'distutils.dist' or caller_name == 'run_commands':
            _install.run(self)
        else:
            self.do_egg_install()
        self.run_command('generate_configuration_files') 
Example #30
Source File: setup.py    From counterblock with MIT License 5 votes vote down vote up
def run(self):
        from counterblock.lib import config_util
        config_util.generate_config_files()