def run(self): ''' We override the basic install command. First we download jars then we run the basic install then we check whether the jars are present in this package. If they aren't present we warn the user and give them some advice on how to retry getting the jars. ''' downloader = MavenJarDownloader() downloader.download_files() if 'do_egg_install' in dir(install): ''' setuptools.command.install checks if it was called directly by setup or by some other code by inspecting the call stack. They do this for backwards compatability. Anyway, when "install" is overriden it calls an older form of install (distutils.command.install) otherwise they call do_egg_install so we try to call do_egg_install otherwise we call install normally (since it should always be present). ''' install.do_egg_install(self) else: install.run(self) missing_jars = downloader.missing_jars() if len(missing_jars) > 0: print(self.warning_string(missing_jars))
def run(self): # For some reason this won't allow dependencies to be installed # install.run(self) # Using this instead install.do_egg_install(self) self.install_chrome_native_host()
def run(self): language = 'zh-CN' appid = 'your_app_id' secretkey ='your_secret_key' neologd = 'C:\\neologd' config = configparser.ConfigParser() if not os.path.isfile(os.path.join(BASE_DIR, 'config.example.ini')): print('"config.example.ini" not found. Exit.') exit(-1) config.read(os.path.join(BASE_DIR, 'config.example.ini')) config.set('global', 'language', language) config.set('global', 'appid', appid) config.set('global', 'secretkey', secretkey) config.set('global', 'neologd', neologd) config.set('global', 'log_level', '20') confirm = 'N' while confirm != 'y': confirm = input('You should backup your config.ini manually if it has been modified. Done? [y/N]') with open(os.path.join(BASE_DIR, 'cp2trans', 'config.ini'), 'w') as f: config.write(f) install.do_egg_install(self) print('You should edit configurations in "config.ini" from directory ' '"PYTHON_HOME\\Lib\\site-packages\cp2trans-*-*.egg\\cp2trans\\".') print('Please perform some post-install steps follow the instructions on "README.md"' ' from https://github.com/EnderQIU/cp2translate to complete the install process.')
def run(self): # setuptools is an oldie goldie. super() is not supported by base class (it's an "old style class") SetuptoolsInstallCommand.do_egg_install(self) import nltk for corpus in _required_nltk_corpora: nltk.download(corpus)
def run(self): install.do_egg_install(self) root_configuration = self.ensure_configuration() self.ensure_credentials(root_configuration) self.ensure_include(config_name, root_configuration) self.ensure_key(config_name, root_configuration)
def run(self): compile_proto() # TODO:// Don't recompile if don't need to if not self._called_from_setup(inspect.currentframe()): # Run in backward-compatibility mode to support bdist_* commands. install.run(self) else: install.do_egg_install(self) # OR: install.do_egg_install(self)
def run(self): assert cmake_is_installed(), "Aborting: please install cmake" assert pythondev_is_installed(), "Aborting: please install python development headers" install.do_egg_install(self) # install_requires... http://stackoverflow.com/a/22179371 with Dirs() as dirs: install_libgit2(dirs) install_pygit2(dirs)
def run(self): _install.do_egg_install(self) import nltk nltk.download("punkt") nltk.download('averaged_perceptron_tagger') nltk.download('wordnet')
def run(self): conf_avail = False if not os.getuid() == 0: print bcolor.RED + "You must run me as root user!" + bcolor.END print bcolor.RED + "Rerun me with sudo " + __file__ + bcolor.END sys.exit(2) _install.do_egg_install(self) print "" print bcolor.CYAN + "Welcome to the Miniprobe (Python) for PRTG installer" + bcolor.END if self.file_check(self.path): print "" probe_config_exists = "%s" % str(raw_input(bcolor.YELLOW + "A config file was already found. Do you want to reconfigure [y/N]: " + bcolor.END)).rstrip().lstrip() if probe_config_exists.lower() == "y": config_old = self.read_config(self.path) self.get_config(config_old) else: print "" uninstall = "%s" % str(raw_input(bcolor.YELLOW + "Do you want to Uninstall or Restart the service [u/R]: " + bcolor.END)).rstrip().lstrip() if uninstall.lower() == "u": self.remove_config() conf_avail = False else: conf_avail = True else: conf_avail = self.get_config(self.config_old) if conf_avail: print subprocess.call("update-rc.d prtgprobe defaults", shell=True) print bcolor.GREEN + "Starting Mini Probe" + bcolor.END print subprocess.call("/etc/init.d/prtgprobe start", shell=True) print bcolor.GREEN + "Done. You now can start/stop the Mini Probe using '/etc/init.d/prtgprobe start' or '/etc/init.d/prtgprobe stop'" + bcolor.END else: print "Exiting!" sys.exit() pass
def run(self): install.do_egg_install(self) # TODO windows if platform == 'Darwin': subprocess.call('install_scripts/osx_installation.sh', shell=True) elif platform == 'Linux': subprocess.call('install_scripts/ubuntu_installation.sh', shell=True)
def run(self): # install rule based learners when asked if self.rl: dir_path = os.path.dirname(os.path.realpath(__file__)) shell_script_path = os.path.join(dir_path, 'setup.sh') subprocess.check_output(['bash', shell_script_path, self.ostype]) install.do_egg_install(self)
def run(self): # install.run(self) install.do_egg_install(self) if os.name == "nt": return xx = self.which('bap') if xx: st = os.stat(xx) os.chmod(xx, st.st_mode | 0o111)
def run(self): here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'wazuh', 'core', 'wazuh.json'), 'w') as f: json.dump({'install_type': self.install_type, 'wazuh_version': self.wazuh_version, 'installation_date': datetime.utcnow().strftime('%a %b %d %H:%M:%S UTC %Y') }, f) # install.run(self) # OR: install.do_egg_install(self) install.do_egg_install(self)
def run(self): _install.do_egg_install(self) import nltk nltk.download("stopwords") import spacy print('Downloading english language model for the spaCy POS tagger\n') from spacy.cli import download download('en_core_web_md')
def run(self): assert cmake_is_installed(), "Aborting: please install cmake" assert pythondev_is_installed( ), "Aborting: please install python development headers" install.do_egg_install( self) # install_requires... http://stackoverflow.com/a/22179371 with Dirs() as dirs: install_libgit2(dirs) install_pygit2(dirs)
def run(self): import optionalgrpc.setup optionalgrpc.setup.compile_proto(project_root="my_foo_project") if not self._called_from_setup(inspect.currentframe()): # Run in backward-compatibility mode to support bdist_* commands. install.run(self) else: install.do_egg_install(self) # OR: install.do_egg_install(self)
def run(self): egg_info = self.get_finalized_command("egg_info") egg_info.additional_backends = self.additional_backends egg_info.additional_backends_directory = self.additional_backends_directory setuptools_install.do_egg_install(self) if self.additional_backends_directory_cloned: shutil.rmtree(self.additional_backends_directory) if self.additional_backends is not None: for symlink in egg_info.additional_backends_symlinks: os.unlink(symlink)
def run(self): try: command = ['conda', 'install', '-y'] packages = open('conda_modules.txt').read().splitlines() command.extend(packages) subprocess.check_call(command) install.do_egg_install(self) except subprocess.CalledProcessError: print( "Conda install failed: do you have Anaconda/miniconda installed and on your PATH?" )
def do_egg_install(self): '''Run install ensuring build_resources called first. .. note:: `do_egg_install` used rather than `run` as sometimes `run` is not called at all by setuptools. ''' self.run_command('build_resources') InstallCommand.do_egg_install(self)
def run(self): _install.do_egg_install(self) import spacy try: spacy.load('en') except RuntimeError: import subprocess args = ['python3 -m spacy download en'] subprocess.call(args, shell=True) _install.run(self)
def parcel_run(self): try: call(['make', 'clean']) check_call(['make']) except Exception as e: logging.error( "Unable to build UDT library: {}".format(e)) if isinstance(self, install): install.do_egg_install(self) else: original(self)
def run(self): # install rule based learners when asked if self.rl: dir_path = os.path.dirname(os.path.realpath(__file__)) shell_script_path = os.path.join(dir_path, 'setup.sh') subprocess.check_output([ 'bash', shell_script_path, self.ostype ]) install.do_egg_install(self)
def run(self): if not _install._called_from_setup(inspect.currentframe()): # The run function from setuptools.command.install doesn't detect # install cmd properly in the current setting of sub classing # Install and therefore we detect it here and do the right thing # for install command otherwise fall back to super class run for # the other cases. _install.run(self) else: _install.do_egg_install(self) self.execute(prepare_release, (self.install_lib, False), msg='Preparing the installation')
def run(self): home_dir = os.path.expanduser('~') deps_file = home_dir + '/.emopt_deps' if (os.path.exists(deps_file)): with open(deps_file, 'r') as fdeps: for line in fdeps: toks = line.rstrip('\r\n').split('=') os.environ[toks[0]] = toks[1] else: pass # install dependencies as needed subprocess.call('make') SetuptoolsInstall.do_egg_install(self)
def run(self): install_custom_sqlite3() install.do_egg_install(self) # Copy the pysqlite2 folder into site-packages under # pymagnitude/third_party/internal/ for good measure import site from glob import glob from distutils.dir_util import copy_tree cp_from = THIRD_PARTY + '/internal/' cp_to = glob(site.getsitepackages()[0] + '/pymagnitude*/' )[0] + '/pymagnitude/third_party/internal/' print("Copying from: ", cp_from, " --> to: ", cp_to) copy_tree(cp_from, cp_to)
def do_egg_install(self): path = os.path.abspath( os.path.join(os.path.dirname(__file__), "rekall-core", "setup.py")) if os.access(path, os.F_OK): print("Installing rekall-core from local directory.") subprocess.check_call([sys.executable, "setup.py", "install"], cwd="rekall-core") # Need to call this directly because _install.run does crazy stack # walking and falls back to compatibility mode. _install.do_egg_install(self)
def do_egg_install(self): path = os.path.abspath( os.path.join(os.path.dirname(__file__), "rekall-core", "setup.py")) if os.access(path, os.F_OK): print "Installing rekall-core from local directory." subprocess.check_call([sys.executable, "setup.py", "install"], cwd="rekall-core") # Need to call this directly because _install.run does crazy stack # walking and falls back to compatibility mode. _install.do_egg_install(self)
def run(self): import os from distutils.sysconfig import get_python_lib for package in install_first: pip.main(['install', package]) install.do_egg_install(self) current_dir = os.path.dirname(os.path.realpath(__file__)) for submodule in git_submodules: pth_path = os.path.join(get_python_lib(), submodule + ".pth") with open(pth_path, 'w') as pth: pth.write(os.path.join(current_dir, submodule) + os.linesep)
def run(self): conf_avail = False if not os.getuid() == 0: print(Bcolor.RED + "You must run me as root user!" + Bcolor.END) print(Bcolor.RED + "Rerun me with sudo " + __file__ + Bcolor.END) sys.exit(2) _install.do_egg_install(self) print("") print(Bcolor.CYAN + "Welcome to the Miniprobe (Python) for PRTG installer" + Bcolor.END) if self.file_check(self.path): print("") probe_config_exists = "%s" % str( raw_input(Bcolor.YELLOW + "A config file was already found. " "Do you want to reconfigure [y/N]: " + Bcolor.END)).rstrip().lstrip() if probe_config_exists.lower() == "y": config_old = self.read_config(self.path) self.get_config(config_old) else: print("") uninstall = "%s" % str( raw_input(Bcolor.YELLOW + "Do you want to Uninstall or Restart the " "service [u/R]: " + Bcolor.END)).rstrip().lstrip() if uninstall.lower() == "u": self.remove_config() conf_avail = False else: conf_avail = True else: conf_avail = self.get_config(self.config_init) if conf_avail: print( subprocess.call("update-rc.d prtgprobe defaults", shell=True)) print(Bcolor.GREEN + "Starting Mini Probe" + Bcolor.END) print( subprocess.call("/etc/init.d/prtgprobe start", shell=True)) print( Bcolor.GREEN + "Done. You now can start/stop the Mini Probe using '/etc/init.d/prtgprobe start' " "or '/etc/init.d/prtgprobe stop'" + Bcolor.END) else: print("Exiting!") sys.exit() pass
def run(self): install.do_egg_install(self) if sys.platform == 'win32': # create desktop shortcut print("Creating desktop shortcut") if RequirePackage('pythoncom', 'pywin32'): args = [ sys.executable, os.path.join(os.path.dirname(__file__), 'win32_shortcut.py') ] subprocess.call(args) else: sys.stderr.write( 'pywin32 unavailable. Cannot create desktop shortcut\n')
def run(self): info = ''' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! ! PLEASE READ COMMENTS IN ~/.magnet/console.sh AND ! ! CHANGE SETTINGS ACCORDING YOUR SYSTEM. ! ! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ''' print(info) cmd_pipeline = "apt-get install -y python-qt4 xdotool && cp -R config %s/.magnet" % os.environ.get( 'HOME') for c in cmd_pipeline.split(' && '): subprocess.check_output(c.split(' ')) install.do_egg_install(self)
def run(self): if not os.environ.get('VIRTUAL_ENV', None): raise DistutilsPlatformError('You must install django-socketio-events into a virtualenv. Aborting.') # print "* * * 1) Do egg install" # hack: i have to do this twice to ensure node is available # for npm install # install.do_egg_install(self) # 1) Install npm depencies into virtualenv/virtual-node print "* * * \t 2) installing npm dependencies" self.run_npm_global() self.run_npm_local() print "* * * 3) Re-do egg install with npm dependencies intact" install.do_egg_install(self)
def run(self): if not os.environ.get('VIRTUAL_ENV', None): raise DistutilsPlatformError('You must install djscript into a virtualenv. Aborting.') install.do_egg_install(self) # POST INSTALL print "* * * Beginning post-install scripts" # module_path = self.install_headers # for thing in dir(self): # print "%s : %s\n\n" % (thing, str(getattr(self, thing))) # 1) Install npm depencies into virtualenv/virtual-node print "* * * \t 1) installing npm dependencies" self.run_npm()
def run(self): if not os.environ.get('VIRTUAL_ENV', None): raise DistutilsPlatformError('You must install nodjango into a virtualenv. Aborting.') # print "* * * 1) Do egg install" # hack: i have to do this twice to ensure node is available # for npm install # install.do_egg_install(self) # 1) Install npm depencies into virtualenv/virtual-node print "* * * \t 2) installing npm dependencies" self.run_npm_global() self.run_npm_local() print "* * * 3) Re-do egg install with npm dependencies intact" install.do_egg_install(self)
def run(self): # Service identity has to be installed before twisted. pip_install("service-identity>=17.0.0") py_version = "{}{}".format(sys.version_info.major, sys.version_info.minor) # Check if platform is Windows and package for Python version is available # Currently python version with enable unicode UCS4 is not supported if os.name == "nt" and sys.version_info.major > 2 and py_version in twisted_py_versions: # Install twisted wheels for windows platform = distutils.util.get_platform().replace("-", "_") wheel_name = twisted_wheel_name.format(version=py_version, platform=platform) pip_install(public_wheels_path.format(wheel_name=wheel_name)) else: # Install from Pypi for other platforms pip_install("Twisted>=17.9.0") _install.do_egg_install(self)
def run(self): # Install shared lib subprocess.run([ "pip3", "install", "git+ssh://[email protected]/PlayspaceDev/pspythonlib.git@master", "--upgrade" ], check=True) subprocess.run(["pip3", "install", "-r", "requirements", "--upgrade"], check=True) os_req = os.path.join("requirements_{os}".format(os=get_os())) if os.path.isfile(os_req): subprocess.run(["pip3", "install", "-r", os_req, "--upgrade"], check=True) _install.do_egg_install(self) self.execute(_post_install, (self.install_lib, ), msg="Running post install task")
def run(self): if is_windows(): print "Installing on Windows." elif is_pi(): print "Installing on Raspberry Pi." self.install_deps_pi() self.install_poly_pi() self.create_lidar_executable() elif is_linux(): print "Installing on Linux." self.install_deps_linux() self.install_poly_linux() else: print 'No suitable operating system detected, terminating install' sys.exit() install.do_egg_install(self)
def run(self): # Regular installation install.do_egg_install(self) # copy sos.vim and sos-detect.vim to .vim vim_syntax_dir = os.path.expanduser('~/.vim/syntax') vim_syntax_file = os.path.join(vim_syntax_dir, 'sos.vim') if not os.path.isdir(vim_syntax_dir): os.makedirs(vim_syntax_dir) shutil.copy('misc/sos.vim', vim_syntax_file) # vim_ftdetect_dir = os.path.expanduser('~/.vim/ftdetect') vim_ftdetect_file = os.path.join(vim_ftdetect_dir, 'sos.vim') if not os.path.isdir(vim_ftdetect_dir): os.makedirs(vim_ftdetect_dir) shutil.copy('misc/sos-detect.vim', vim_ftdetect_file) log.info('\nSoS is installed and configured to use with vim.') log.info('Use "set syntax=sos" to enable syntax highlighting.')
def run(self): import os import pip from distutils.sysconfig import get_python_lib self.requirements = {k: self._read_requirements(v) for k, v in self.files.items()} for package in self.requirements['install_first']: pip.main(['install', package]) install.do_egg_install(self) current_dir = os.path.dirname(os.path.realpath(__file__)) for submodule in self.requirements['submodules']: pth_path = os.path.join(get_python_lib(), submodule + ".pth") with open(pth_path, 'w') as pth: pth.write(os.path.join(current_dir, submodule) + os.linesep)
def run(self): """ Override 'install' command First execute the default setup() function which will install necessary dependencies, prepare packages, etc. Then install the problematic stuff - netifaces (for all operating systems) and NetfilterQueue (only on Linux). """ # install # run the default install first # NOTE: install.run(self) is ignoring 'install_requires' # http://stackoverflow.com/a/22179371/4183498 install.do_egg_install(self) # netifaces # netifaces has a known bug when installing as a dependency, i.e. # as an item of `install_requires`, but it works this way # https://github.com/GNS3/gns3-server/issues/97 try: pip.main(['install', 'netifaces>=0.10.4']) except Exception as exc: print('*** Failed to install netifaces ***\n', exc) # NetfilterQueue # Python 3.x patched NetFilterQueue which comes with SFC package, # PyPI has only a version for Python 2.x # https://pypi.python.org/pypi/NetfilterQueue/0.3 if sys.platform.startswith('linux'): parent_dir = os.path.dirname(os.path.abspath(__file__)) nfq_dir = os.path.join('nfq', 'NetfilterQueue-0.3.1-P3.3') try: if hasattr(sys, 'real_prefix'): python = 'python' # virtualenv install else: python = 'python3.4' # normal install os.chdir(nfq_dir) subprocess.check_call([python, 'setup.py', 'install']) os.chdir(parent_dir) except Exception as exc: print('*** Failed to install NetfilterQueue ***\n', exc)
def run(self): subprocess.call(["pip install -r requirements.txt --no-clean"], shell=True) download_binaries() subprocess.call(['bash', SCRIPT_INSTALL_REQS]) install.do_egg_install(self)
def run(self): _install.do_egg_install(self) post_install(self, self.with_serpent)
if irace_1_07: # Install IRACE cur_dir = os.getcwd() os.chdir(os.path.join(optimizer_dir, 'irace')) call = "R CMD INSTALL irace_1.07.tar.gz -l `pwd`" try: subprocess.check_call(call, shell=True) except subprocess.CalledProcessError, e: sys.stdout.write("Installing IRACE did not work: %s\n" % e) irace_1_07 = False os.chdir(cur_dir) # TODO: Normally one wants to call run(self), but this runs distutils and ignores install_requirements for unknown reasons # if anyone knows a better way, feel free to change install.do_egg_install(self) # Give detailed output to user # TODO generate this output automatically! if not tpe or not smac or not spearmint or not smac_2_08 or not smac_2_10 or not irace_1_07: sys.stderr.write("[ERROR] Something went wrong while copying and downloading optimizers." + "Please do the following to be ready to start optimizing:\n\n" + "cd optimizers\n" + "wget http://www.automl.org/hyperopt_august2013_mod_src.tar.gz \n" + "wget http://www.automl.org/smac_2_06_01-dev_src.tar.gz \n" + "wget http://www.automl.org/smac_2_08_00-master_src.tar.gz \n" "wget http://www.automl.org/smac_2_10_00-dev_src.tar.gz \n" + "wget http://www.automl.org/spearmint_april2013_mod_src.tar.gz \n" + "tar -xf hyperopt_august2013_mod_src.tar.gz \n" + "mv hyperopt_august2013_mod_src tpe/ \n" + "tar -xf smac_2_06_01-dev_src.tar.gz \n" +
def run(self): install.do_egg_install(self) self._install_data("share/applications") self._install_data("man")
def run(self): _install.do_egg_install(self) import nltk nltk.download('punkt') nltk.download('averaged_perceptron_tagger')
def run(self): _install.do_egg_install(self) import nltk nltk.download("averaged_perceptron_tagger")
def run(self): _install.do_egg_install(self) import nltk nltk.download("wordnet")
def run(self): install.do_egg_install(self)
def run(self): # Regular installation install.do_egg_install(self) # copy sos.vim and sos-detect.vim to .vim vim_syntax_dir = os.path.expanduser('~/.vim/syntax') vim_syntax_file = os.path.join(vim_syntax_dir, 'sos.vim') if not os.path.isdir(vim_syntax_dir): os.makedirs(vim_syntax_dir) shutil.copy('misc/sos.vim', vim_syntax_file) # vim_ftdetect_dir = os.path.expanduser('~/.vim/ftdetect') vim_ftdetect_file = os.path.join(vim_ftdetect_dir, 'sos.vim') if not os.path.isdir(vim_ftdetect_dir): os.makedirs(vim_ftdetect_dir) shutil.copy('misc/sos-detect.vim', vim_ftdetect_file) # copy vim-ipython to .vim/ftplugin vim_plugin_dir = os.path.expanduser('~/.vim/ftplugin/sos') if not os.path.isdir(vim_plugin_dir): os.makedirs(vim_plugin_dir) shutil.copy('misc/vim-ipython/ipy.vim', os.path.join(vim_plugin_dir, 'ipy.vim')) shutil.copy('misc/vim-ipython/vim_ipython.py', os.path.join(vim_plugin_dir, 'vim_ipython.py')) # # at this point, jupyter and ipython should have been installed. import json try: from jupyter_client.kernelspec import KernelSpecManager as KS except ImportError: from ipykernel.kernelspec import KernelSpecManager as KS from IPython.utils.tempdir import TemporaryDirectory from IPython.paths import get_ipython_dir # # copy ipython magic to ~/.ipython/extensions ext_dir = os.path.join(get_ipython_dir(), 'extensions') ext_file = os.path.join(ext_dir, 'sos_magic.py') if not os.path.isdir(ext_dir): os.makedirs(ext_dir) prof_dir = os.path.join(get_ipython_dir(), 'profile_sos') prof_file = os.path.join(prof_dir, 'ipython_config.py') if not os.path.isdir(prof_dir): os.makedirs(prof_dir) # shutil.copy('sos/jupyter/sos_magic.py', ext_file) shutil.copy('sos/jupyter/sos_ipython_profile.py', prof_file) # log.info('\nSoS is installed and configured to use with vim, ipython, and Jupyter.') log.info('Use "set syntax=sos" to enable syntax highlighting.') log.info('Use "ipython --profile sos" to start ipython with sos magic.') # # Now write the kernelspec with TemporaryDirectory() as td: os.chmod(td, 0o755) # Starts off as 700, not user readable shutil.copy('sos/jupyter/sos_codemirror.js', os.path.join(td, 'kernel.js')) with open(os.path.join(td, 'kernel.json'), 'w') as f: json.dump(kernel_json, f, sort_keys=True) try: KS().install_kernel_spec(td, 'sos', user=self.user, replace=True, prefix=sys.exec_prefix) log.info('Use "jupyter notebook" to create or open SoS notebooks.') except: log.error("\nWARNING: Could not install SoS Kernel as %s user." % self.user) log.info('Run "python misc/patch_spyder.py" to patch spyder with sos support.') log.info('And "sos -h" to start using Script of Scripts.')
def do_egg_install(self): self.run_command('build_proto') InstallCommand.do_egg_install(self)
def run(self): default_install.do_egg_install(self) import nltk nltk.download("all")
def run(self): default_install.do_egg_install(self) cabal_install(name=name, license=license, author=author, maintainer=maintainer, category=category, modules=modules, linker_args=linker_args, depends=depends)
def run(self): try: shutil.rmtree(DOWNLOAD_DIRECTORY) except Exception: pass try: os.makedirs(DOWNLOAD_DIRECTORY) except Exception: pass for download_url, filename in [ (SMAC_DOWNLOAD_LOCATION, SMAC_TAR_NAME), # (METADATA_LOCATION, METADATA_TAR_NAME), (RUNSOLVER_LOCATION, RUNSOLVER_TAR_NAME) ]: # This can fail ungracefully, because having these files is # crucial to AutoSklearn! urllib.urlretrieve( os.path.join(download_url, filename), filename=os.path.join(DOWNLOAD_DIRECTORY, filename)) tfile = tarfile.open(os.path.join(DOWNLOAD_DIRECTORY, filename)) tfile.extractall(os.path.join( DOWNLOAD_DIRECTORY, filename.replace('.tar.gz', '').replace('.tar.bz2', ''))) # Build the runsolver sys.stdout.write('Building runsolver\n') cur_pwd = os.getcwd() runsolver_source_path = os.path.join(DOWNLOAD_DIRECTORY, 'runsolver-3.3.4', 'runsolver', 'src') os.chdir(runsolver_source_path) subprocess.check_call('make') os.chdir(cur_pwd) # Create a fresh binaries directory try: shutil.rmtree(BINARIES_DIRECTORY) except Exception: pass try: os.makedirs(BINARIES_DIRECTORY) with open(os.path.join(BINARIES_DIRECTORY, '__init__.py')): pass except Exception: pass # Copy the runsolver into the sources so it gets copied shutil.move(os.path.join(runsolver_source_path, 'runsolver'), os.path.join(BINARIES_DIRECTORY, 'runsolver')) # Copy SMAC shutil.move(os.path.join(DOWNLOAD_DIRECTORY, SMAC_TAR_NAME.replace('.tar.gz', '')), BINARIES_DIRECTORY) # try: # shutil.rmtree(METADATA_DIRECTORY) # except Exception: # pass # Copy the metadata # shutil.move(os.path.join(DOWNLOAD_DIRECTORY, # METADATA_TAR_NAME.replace(".tar.gz", ""), # "files"), # METADATA_DIRECTORY) # TODO: Normally one wants to call run(self), but this runs distutils and ignores install_requirements for unknown reasons # if anyone knows a better way, feel free to change install.do_egg_install(self) # shutil.rmtree(os.path.join(METADATA_DIRECTORY)) shutil.rmtree(BINARIES_DIRECTORY) shutil.rmtree(DOWNLOAD_DIRECTORY)
def run(self): if platform.system().lower() == "linux": global build_driver build_driver = True _install.do_egg_install(self)
def run(self): try: shutil.rmtree(DOWNLOAD_DIRECTORY) except Exception: pass try: os.makedirs(DOWNLOAD_DIRECTORY) except Exception: pass for download_url, filename in [ (SMAC_DOWNLOAD_LOCATION, SMAC_TAR_NAME), (RUNSOLVER_LOCATION, RUNSOLVER_TAR_NAME), ]: # This can fail ungracefully, because having these files is # crucial to AutoSklearn! urlretrieve(os.path.join(download_url, filename), filename=os.path.join(DOWNLOAD_DIRECTORY, filename)) tfile = tarfile.open(os.path.join(DOWNLOAD_DIRECTORY, filename)) tfile.extractall(os.path.join(DOWNLOAD_DIRECTORY, filename.replace(".tar.gz", "").replace(".tar.bz2", ""))) # Build the runsolver sys.stdout.write("Building runsolver\n") cur_pwd = os.getcwd() runsolver_source_path = os.path.join(DOWNLOAD_DIRECTORY, "runsolver-3.3.4", "runsolver", "src") os.chdir(runsolver_source_path) subprocess.check_call("make") os.chdir(cur_pwd) # Create a fresh binaries directory try: shutil.rmtree(BINARIES_DIRECTORY) except Exception: pass try: os.makedirs(BINARIES_DIRECTORY) with open(os.path.join(BINARIES_DIRECTORY, "__init__.py")): pass except Exception: pass # Copy the runsolver into the sources so it gets copied shutil.move(os.path.join(runsolver_source_path, "runsolver"), os.path.join(BINARIES_DIRECTORY, "runsolver")) # Copy SMAC shutil.move(os.path.join(DOWNLOAD_DIRECTORY, SMAC_TAR_NAME.replace(".tar.gz", "")), BINARIES_DIRECTORY) # Normally one wants to call run(self), but this runs distutils and # ignores install_requirements for unknown reasons # if anyone knows a better way, feel free to change install.do_egg_install(self) try: shutil.rmtree(BINARIES_DIRECTORY) except OSError: pass try: shutil.rmtree(DOWNLOAD_DIRECTORY) except OSError: pass
def run(self): _install.do_egg_install(self) import nltk nltk.download("punkt")
def run(self): _install.do_egg_install(self) self.run_command('generate_configuration_files')