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_install(self): """ The definition of the "run" method for the CustomInstallCommand metaclass. """ # Get paths tethysapp_dir = get_tethysapp_directory() destination_dir = os.path.join(tethysapp_dir, self.app_package) # Notify user print('Copying App Package: {0} to {1}'.format(self.app_package_dir, destination_dir)) # Copy files try: shutil.copytree(self.app_package_dir, destination_dir) except: try: shutil.rmtree(destination_dir) except: os.remove(destination_dir) shutil.copytree(self.app_package_dir, destination_dir) # Install dependencies for dependency in self.dependencies: subprocess.call(['pip', 'install', dependency]) # Run the original install command install.run(self)
def run(self): _install.run(self) # the second parameter, [], can be replaced with a set of # parameters if _post_install needs any self.execute(_post_install, [], msg="Running post install task")
def run(self): # Call subprocess to run te 'pip' command. # Only works, when user installs from sdist call(['pip', 'install', '-r', 'requirements.txt']) # Run 'install' to install lyrico install.run(self)
def run(self): _install.run(self) self.execute( self.__post_install, (self.install_lib,), msg="installing auto completion" )
def run(self): this_dir = os.path.dirname(os.path.realpath(__file__)) self.C_SOURCE = os.path.join(this_dir, 'word2vec', 'c') self.TARGET_DIR = 'bin' if sys.platform == 'win32': self.TARGET_DIR = 'Scripts' if not os.path.exists(self.TARGET_DIR): os.makedirs(self.TARGET_DIR) if sys.platform == 'win32': self.compile_c('win32/word2vec.c', 'word2vec.exe') self.compile_c('win32/word2phrase.c', 'word2phrase.exe') self.compile_c('win32/distance.c', 'word2vec-distance.exe') self.compile_c('win32/word-analogy.c', 'word2vec-word-analogy.exe') self.compile_c('win32/compute-accuracy.c', 'word2vec-compute-accuracy.exe') else: self.compile_c('word2vec.c', 'word2vec') self.compile_c('word2phrase.c', 'word2phrase') self.compile_c('distance.c', 'word2vec-distance') self.compile_c('word-analogy.c', 'word2vec-word-analogy') self.compile_c('compute-accuracy.c', 'word2vec-compute-accuracy') self.compile_c('word2vec-sentence2vec.c', 'word2vec-doc2vec') _install.run(self)
def run(self): if not self.no_jars: import cmmnbuild_dep_manager mgr = cmmnbuild_dep_manager.Manager() mgr.install('pytimber') print('registered pytimber with cmmnbuild_dep_manager') _install.run(self)
def run(self): install.run(self) try: import oil_library except ImportError: print "oil_library not found - installing it now \n" build_oil_lib("install")
def run(self): install.run(self) try: # ignore failures since the tray icon is an optional component: call(['gtk-update-icon-cache', theme_base]) except OSError: logging.warn(sys.exc_info()[1])
def run(self): # Note(Kevin): On Python 2, Bajoo should uses the stable 'Classic' # version. This version must be installed manually by the user # (usually the package manager of the distribution). # On python 3, Bajoo uses the 'Phoenix' version of wxPython. # At this time, the Phoenix version is not stable yet, and only daily # snapshots are available. # About wxVersion: # Some systems allowed several version of wxPython to be installed # wxVersion allows to pick a version. # If wxVersion is not available, either wxPython is not installed, # either the system only allows only one version of wxPython. if not self.force and sys.version_info[0] is 2: try: import wxversion try: wxversion.select(['3.0', '2.9', '2.8']) except wxversion.VersionError: pass except ImportError: pass try: import wx # noqa except ImportError: print("""\ Bajoo depends on the library wxPython. This library is not available in the Python Package Index (pypi), and so can't be automatically installed. On Linux, you can install it from your distribution's package repositories. On Windows, you can download it from http://wxpython.org/download.php""") raise Exception('wxPython not found.') InstallCommand.run(self)
def run(self): _install.run(self) try: import server_manager.client import server_manager.contrail client_dir = os.path.dirname(server_manager.client.__file__) json_files = client_dir+'/*.json' json_list = glob.glob(json_files) dst_location = '/etc/contrail_smgr' if not os.path.exists(dst_location): os.makedirs(dst_location) print ("Coping to %s") % (dst_location) for jfile in json_list: shutil.copy(jfile, dst_location) print jfile ini_files = client_dir+'/*.ini' ini_list = glob.glob(ini_files) for ifile in ini_list: shutil.copy(ifile, dst_location) print ifile contrail_dir = os.path.dirname(server_manager.contrail.__file__) xml_files = contrail_dir+'/*.xml' xml_list = glob.glob(xml_files) for xmlfile in xml_list: shutil.copy(xmlfile, dst_location) print xmlfile except: print "Post installation failed"
def run(self): install.run(self) OS = system() if OS == 'Windows': call(["toxygen", "--configure"]) elif OS == 'Linux': call(["toxygen", "--clean"])
def run(self): """Runs the install and post-install actions""" install.run(self) log.info("Preparing/extracting location database and data for import...") self.prep_location_data() log.info("Importing location data into location database...") database = sqlite3.connect(self.install_lib+'cahoots/parsers/location/data/location.sqlite') database.text_factory = str cursor = database.cursor() log.info("Importing city data...") self.import_city_data(cursor) log.info("Importing country data...") self.import_country_data(cursor) log.info("Importing street suffix data...") self.import_street_suffix_data(cursor) log.info("Importing landmark data...") self.import_landmark_data(cursor) database.commit() database.close() log.info('Cleaning up location import temporary files...') self.cleanup_location_data() log.info('Done!')
def run(self): """ Overwrite the 'real' run method to install the packages we need. """ if not self.checkIfRoot() and "--force" not in sys.argv: print "You need to be root to install this package, as some dependencies need to be installed." print "Run this install with --force as a parameter to try installing without root permissions." return False self.getInstalledPackages() if not self.installPipRequirements(): raise Exception, "Not all dependencies installed." return False if not skipPySide: if not self.installPySide(): raise Exception, "Not all dependencies installed." return False if not self.installLibFreeType(): raise Exception, "Not all dependencies installed." return False if not self.installGearman(): print "Not all dependencies installed." raise Exception, "Not all dependencies installed." # Do the regular install stuff install.run(self)
def run(self): if sys.platform not in ('linux3', 'linux2', 'win32', 'darwin'): msg = "**Error: Can't install on this platform: %s" % sys.platform print msg sys.exit(1) # create build/share directory dir_util.mkpath(os.path.join(self.build_base, 'share', 'bauble')) if not self.single_version_externally_managed: self.do_egg_install() else: _install.run(self) # install bauble.desktop and icons if sys.platform in ('linux3', 'linux2'): # install everything in share dir_util.copy_tree(os.path.join(self.build_base, 'share'), os.path.join(self.install_data, 'share')) elif sys.platform == 'win32': # install only i18n files locales = os.path.dirname(locale_path) install_cmd = self.get_finalized_command('install') build_base = install_cmd.build_base src = os.path.join(build_base, locales) dir_util.copy_tree(src, os.path.join(self.install_data, locales)) file_util.copy_file( "LICENSE", os.path.join(self.install_data, 'share', 'bauble', 'LICENSE'))
def run(self): install.run(self) #cert_path = self.install_data + "cert/" cert_path = "/etc/tilera-phishing/cert/" print bcolors.WARNING + "Be sure to copy your certificate files here :" + bcolors.ENDC print bcolors.WARNING + cert_path + "ca.crt" + bcolors.ENDC print bcolors.WARNING + cert_path + "ca.key" + bcolors.ENDC
def run(self): subprocess.check_call(['patch', '-d', CHDKPTP_PATH, '-i', CHDKPTP_PATCH, '-p', '1']) os.symlink(os.path.join(CHDKPTP_PATH, 'config-sample-linux.mk'), os.path.join(CHDKPTP_PATH, 'config.mk')) subprocess.check_call(['make', '-C', CHDKPTP_PATH]) InstallCommand.run(self)
def run(self): install.run(self) import sys # check about wxwidgets try: import wxversion wxversion.select("3.0") except: with open("install-wxpython.sh", "w") as shell_script: shell_script.write( """#!/bin/sh echo 'Prerrequisites' apt-get --yes --force-yes install libgconf2-dev libgtk2.0-dev libgtk-3-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgconfmm-2.6-dev libwebkitgtk-dev python-gtk2 mkdir -p external cd external echo "Downloading wxPython 3.0.2.0" wget http://downloads.sourceforge.net/project/wxpython/wxPython/3.0.2.0/wxPython-src-3.0.2.0.tar.bz2 echo "Done" echo 'Uncompressing ...' tar -xjvf wxPython-src-3.0.2.0.tar.bz2 echo 'Patching ...' cd wxPython-src-3.0.2.0 cd wxPython sed -i -e 's/PyErr_Format(PyExc_RuntimeError, mesg)/PyErr_Format(PyExc_RuntimeError, "%s\", mesg)/g' src/gtk/*.cpp contrib/gizmos/gtk/*.cpp python ./build-wxpython.py --build_dir=../bld --install ldconfig cd ../../.. rm -rf external """ ) os.system("sh ./install-wxpython.sh")
def run(self): # Perform a normal install. install.run(self) # Change permissions of the installed .py and .pyc files. for fileName in self.get_outputs(): if fileName.endswith(('.py', '.pyc')): chmod(fileName, 420) # 420 decimal = 644 octal
def run(self): # Update the defaults if needed. if self.config_file: with open("grr/defaults.py", "wb") as fd: fd.write(self.DEFAULT_TEMPLATE % dict(CONFIG_FILE=self.config_file)) install.run(self)
def run(self): from distutils import log from os.path import abspath from os import chdir, getcwd self.distribution.run_command('build') current_cwd = getcwd() build_dir = join(dirname(abspath(__file__)), self.build_base) cmake = cmake_executable() pkg = abspath(self.install_lib) log.info("CMake: Installing package to %s" % pkg) try: chdir(build_dir) self.spawn([cmake, '-DPYTHON_PKG_DIR=\'%s\'' % pkg, '-DPYPACKED=TRUE', '..' ]) self.spawn([cmake, '--build', '.', '--target', 'install']) finally: chdir(current_cwd) try: prior = getattr(self.distribution, 'running_binary', False) self.distribution.running_binary = True self.distribution.have_run['egg_info'] = 0 dInstall.run(self) finally: self.distribution.running_binary = prior
def run(self): if sys.platform not in ("linux2", "win32"): msg = "**Error: Can't install on this platform: %s" % sys.platform print msg sys.exit(1) if not self.single_version_externally_managed: self.do_egg_install() else: _install.run(self) # check if someone else is copying the files to the destination # if self.single_version_externally_managed:# and not self.root: # return # install bauble.desktop and icons if sys.platform == "linux2": # install everything in share dir_util.copy_tree(os.path.join(self.build_base, "share"), os.path.join(self.install_data, "share")) elif sys.platform == "win32": # install only i18n files locales = os.path.dirname(locale_path) install_cmd = self.get_finalized_command("install") build_base = install_cmd.build_base src = os.path.join(build_base, locales) dir_util.copy_tree(src, os.path.join(self.install_data, locales))
def run(self): if (not check_system_dependencies() or not check_version_dependencies() or not check_py_dependencies()): print 'Can not find all requires' #raise EnvironmentError _install.run(self)
def run(self): install_.run(self) if self.h5plugin: if H51811P: pass else: print("HDF5 < 1.8.11, not installing filter plugins.") return #from h5py import h5 #h5version = h5.get_libversion() plugin_build = path.join(self.build_lib, "bitshuffle", "plugin") try: os.makedirs(self.h5plugin_dir) except OSError as e: if e.args[0] == 17: # Directory already exists, this is fine. pass else: raise plugin_libs = glob.glob(path.join(plugin_build, "*")) for plugin_lib in plugin_libs: plugin_name = path.split(plugin_lib)[1] shutil.copy2(plugin_lib, path.join(self.h5plugin_dir, plugin_name)) print("Installed HDF5 filter plugins to %s" % self.h5plugin_dir)
def run(self): projpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'vpnadmin') print 'Generating MO files in %s' % projpath subprocess.call(['django-admin.py', 'compilemessages'], cwd=projpath) install.run(self)
def run(self): print "Running custom install script" ver = sys.version_info[:2] if ver == (2, 6): version = '2.6' if ver == (2, 7): version = '2.7' pkg='/usr/lib/python'+version+'/site-packages/gangliarest' mode = 0751 src = '/usr/lib/python'+version+'/site-packages/gangliarest/gangliaRest.py' dst = '/usr/local/sbin/GangliaRest' cfg_file = '/etc/GangliaRest.cfg' new_cfg_file = 'etc/GangliaRest.cfg' install.run(self) if not os.path.exists(dst): os.symlink(src,dst) if os.path.exists(cfg_file): os.rename(cfg_file, cfg_file+'.save') print("Backed up original config file as %s.save" % cfg_file) copyfile(new_cfg_file,cfg_file) for dirpath, dirnames, filenames in os.walk(pkg): for filename in filenames: path = os.path.join(dirpath, filename) os.chmod(path, 0751) print("New /etc/GangliaRest.cfg file has been installed. Be sure to reconfigure.")
def run(self): install.run(self) subprocess.call(os.path.join(sys.path[0], 'hotrc/reload.sh')) path = os.path.join(sys.path[0], 'hotrc/path.sh') sys.path.append(sys.path[0]) subprocess.call(path, shell=True) subprocess.call(['source ~/.bashrc'], shell=True)
def run(self): # run original install code install.run(self) # install BBSVM executables print('running install_bbsvm') self.copy_tree(self.build_lib, self.install_lib)
def run(self): _install.run(self) if '--user' in sys.argv[-1] : userdir = site.getusersitepackages()+"/pyasp/bin" self.get_binaries(userdir) cmd="chmod +x "+userdir+"/*" print(cmd) os.system(cmd) else : py_version = "%s.%s" % (sys.version_info[0], sys.version_info[1]) paths = [] paths.append(sys.prefix+"/lib/python%s/dist-packages/pyasp/bin" % py_version) paths.append(sys.prefix+"/lib/python%s/site-packages/pyasp/bin" % py_version) paths.append(sys.prefix+"/local/lib/python%s/dist-packages/pyasp/bin" % py_version) paths.append(sys.prefix+"/local/lib/python%s/site-packages/pyasp/bin" % py_version) paths.append("/Library/Python/%s/site-packages/pyasp/bin" % py_version) cmd = None for path in paths: if os.path.exists(path): self.get_binaries(path) cmd = "chmod +x "+path+"/*" break if cmd: print(cmd) os.system(cmd) else: print("pyasp binaries path not found. You need to download and put in place the binaries for gringo3, gringo4 and clasp in order to start using pyasp.")
def run(self): _install.run(self) if self.register_service: osutil = get_osutil() osutil.register_agent_service() osutil.stop_agent_service() osutil.start_agent_service()
def run(self, *args, **kwargs): import pip pip.main(['install', '.']) InstallCommand.run(self, *args, **kwargs)