Beispiel #1
0
    def run(self):
        install.run(self)
        try:
            from jupyter_client.kernelspec import install_kernel_spec
        except ImportError:
            from IPython.kernel.kernelspec import install_kernel_spec
        from IPython.utils.tempdir import TemporaryDirectory

        # Install unix port
        with TemporaryDirectory() as td:
            os.chmod(td, 0o755)
            with open(os.path.join(td, 'kernel.json'), 'w') as f:
                json.dump(kernel_json_unix, f, sort_keys=True)
            kernel_name = 'mp' + pkg_unix
            try:
                install_kernel_spec(td, kernel_name=kernel_name,
                                    user=self.user, replace=True)
            except:
                install_kernel_spec(td, kernel_name=kernel_name,
                                    user=not self.user, replace=True)

        # Install pyboard port
        with TemporaryDirectory() as td:
            os.chmod(td, 0o755)
            with open(os.path.join(td, 'kernel.json'), 'w') as f:
                json.dump(kernel_json_pyboard, f, sort_keys=True)
            kernel_name = 'mp' + pkg_stmhal
            try:
                install_kernel_spec(td, kernel_name=kernel_name,
                                    user=self.user, replace=True)
            except:
                install_kernel_spec(td, kernel_name=kernel_name,
                                    user=not self.user, replace=True)
Beispiel #2
0
    def run(self):

        # create installer_config.py with final paths
        fn = 'python/skytools/installer_config.py'
        cf = open(fn + '.in', 'r').read()
        cf = cf.replace('@SQLDIR@', os.path.join(self.prefix, 'share/skytools3'))
        cf = cf.replace('@PACKAGE_VERSION@', ac_ver)
        cf = cf.replace('@SKYLOG@', self.skylog and '1' or '0')
        open(fn, 'w').write(cf)

        # move python modules
        if self.sk3_subdir:
            subdir = 'skytools-3.0'
            self.install_lib = os.path.join(self.install_lib, subdir)
            self.install_purelib = os.path.join(self.install_purelib, subdir)
            self.install_platlib = os.path.join(self.install_platlib, subdir)

        # generic install
        install.run(self)

        # fix scripts
        for sfn in sfx_scripts:
            fixscript(sfn, self.install_scripts, self.script_suffix)
        for sfn in nosfx_scripts:
            fixscript(sfn, self.install_scripts, DEF_NOSUFFIX)
 def run(self):
     install.run(self)
     # write installation log file
     with open(INSTALL_LOG, 'w') as stream:
         outputs = map(os.path.normpath, self.get_outputs())
         stream.write('\n'.join(outputs))
         stream.write('\n')
Beispiel #4
0
    def run(self):
        test_res_path = os.path.join("build", ".tests_results")
        test_res = 0
        if os.path.exists(test_res_path):
            with open(test_res_path) as _file:
                test_res = int(_file.readline().strip())
                if not test_res:
                    msg = "Unit tests failed. It is _highly_ recommended to fix the problem, before installing"
        else:
            msg = """Unit tests are available. It is _highly_ recommended to run tests now, before installing
to run test, run 'python setup.py test'"""

        if not test_res: #test_res = 0 => test fails ore test not ran
            test_OK = raw_input( "{}\nAre you sure you want to install anyway (y/N) ?".format(msg))
            if test_OK.lower() in ('y', 'yes'):
                test_OK = True
            else:
                test_OK = False
        else:
            #test_res = 1
            test_OK = True
        if test_OK:
            for _file in fix_prefix:
                input_file = os.path.join(self.build_lib, _file)
                output_file =  input_file + '.tmp'
                subst_vars( input_file, output_file, {'PREFIX': self.prefix})
                os.unlink(input_file)
                self.move_file(output_file, input_file) 
            install.run(self)
Beispiel #5
0
    def run(self):
        install.run(self)

        for script in self.distribution.scripts:
            script_path = os.path.join(self.install_scripts,
                                       os.path.basename(script))
            with open(script_path, 'r') as f:
                content = f.read()
            content = content.replace('@ INSTALLED_BASE_DIR @',
                                      self._custom_data_dir)
            with open(script_path, 'w') as f:
                f.write(content)

            src_desktop = self.distribution.get_name() + '.desktop'
            src_desktop = src_desktop.lower()

            if not os.path.exists(self._custom_apps_dir):
                os.makedirs(self._custom_apps_dir)
            dst_desktop = os.path.join(self._custom_apps_dir, src_desktop)
            with open(src_desktop, 'r') as f:
                content = f.read()
            icon = os.path.join(self._custom_data_dir, 'src', 'images',
                                'icon.png')
            content = content.replace('@ INSTALLED_ICON @', icon)
            with open(dst_desktop, 'w') as f:
                f.write(content)
Beispiel #6
0
    def run(self):
        if check_dependencies() is None:
            print 'Unable to import package `chroma`'
            sys.exit(1)

        compile_solib()
        install.run(self)
Beispiel #7
0
    def run(self):
        # Installation begins
        install.run(self)

        # Install i18
        for lang in I18N_LANGUAGES:
            print "Installing '%s' translations..." % lang
            os.popen("msgfmt po/%s.po -o po/%s.mo" % (lang, lang))
            if not self.root:
                self.root = "/"
            destpath = os.path.join(self.root, "usr/share/locale/%s/LC_MESSAGES" % lang)
            try:
                os.makedirs(destpath)
            except:
                pass
            shutil.copy("po/%s.mo" % lang, os.path.join(destpath, "%s.mo" % I18N_DOMAIN))

        # YALI's main module path on the system
        yali_bin = os.path.join(yali_dir, "main.py")

        # Make YALI executable
        print "Changing file modes..."
        os.chmod(yali_bin, 0755)

        # Symlink to /usr/bin as yali-bin
        print "Creating symbolic links..."
        os.symlink(yali_bin, os.path.join("/usr/bin/yali-bin"))
Beispiel #8
0
    def run(self):
        # Check for some of the required python packages
        for ppkg in requires:
            try:
                __import__(ppkg)
            except:
                raise RuntimeError('Failed to locate required package: %s  ' % ppkg)

        etcdirectory = os.path.join(self.install_data, 'etc')
        if not os.path.exists(etcdirectory):
            os.makedirs(etcdirectory)

        filename = os.path.join(etcdirectory, 'pyburst-user-env.sh')
        self.execute(write_file,
                     (filename, [self.extra_dirs]),
                     "creating %s" % filename)

        env_file = open(filename, 'w')
        print >> env_file, "# Source this file to access PyBurst"
        print >> env_file, "PATH=" + self.install_scripts + ":$PATH"
        print >> env_file, "PYTHONPATH=" + self.install_libbase + ":$PYTHONPATH"
        print >> env_file, "export PYTHONPATH"
        print >> env_file, "export PATH"
        env_file.close()
        _install.run(self)
Beispiel #9
0
 def run(self):
     print "compiling gettext files"
     os.chdir("po")
     for fname in glob.glob("*.po"):
         os.spawnl(os.P_WAIT, "./compilepo.sh", "./compilepo.sh", fname[:-3], self.root, self.prefix)
     os.chdir(os.pardir)
     _install.run(self)
Beispiel #10
0
 def run(self):
     # Run the normal install
     _install.run(self)
     # Post-install configuration goes here
     # Install gconf schemas
     subprocess.call(["gconftool-2", "--install-schema-file",
                      "share/curator.schemas"])
 def run(self):
     install.run(self)
     stream = open(INSTALL_LOG, 'w')
     outputs = self.get_outputs()
     stream.write('\n'.join(outputs))
     stream.write('\n')
     stream.close()
Beispiel #12
0
    def run(self):
        install.run(self)
        self.install_pymol_path()
        self.make_launch_script()

        if self.bundled_pmw:
            os.system("tar -C %s -zxvf modules/pmg_tk/pmw.tgz" % self.install_libbase)
Beispiel #13
0
 def run(self):
     install.run(self)
     self.install_kernel_spec()
     log.info('Cleaning up stale installed files....')
     t = time.time()
     self.clean_stale_files()
     log.info('Finished cleaning, time: %.2f seconds.' % (time.time() - t))
Beispiel #14
0
 def run(self):
     install.run(self)
     for lang in i18n_languages.split(' '):
         print "Installing '%s' translations..." % lang
         os.popen("msgfmt po/%s.po -o po/%s.mo" % (lang, lang))
         shutil.copy("po/%s.mo" % lang,
             "/usr/share/locale/%s/LC_MESSAGES/%s.mo" % (lang, i18n_domain))
Beispiel #15
0
 def run(self):
     """
     Override the run function to also run post-install tasks.
     """
     install.run(self)
     self.execute(self.run_post_install_tasks, (), 
                  msg="Running post install tasks")
Beispiel #16
0
 def run(self):
     install.run(self)
     if os.sep == '/':
         binPath = join(self.install_scripts, 'pyglossary')
         log.info('creating script file "%s"'%binPath)
         open(binPath, 'w').write(join(self.install_data, relRootDir, 'pyglossary.pyw'))
         os.chmod(binPath, 0o755)
    def run(self):
        required_packages = [("PySide", "1.2.1"), ("matplotlib", "1.3.1"),
                             ("netifaces", "0.8")]
        packages_not_found = []

        for package, version in required_packages:
            try:
                module = import_module(package)
                try:
                    if StrictVersion(module.__version__) < StrictVersion(version):
                        packages_not_found.append((package, version))
                except AttributeError:
                    # some packages like netifaces don't have __version__ attribute set,
                    # try using pkg_resource
                    if StrictVersion(get_distribution(package).version) < StrictVersion(version):
                        packages_not_found.append((package, version))
            except ImportError:
                packages_not_found.append((package, version))

        if packages_not_found:
            print "Please install the following packages manually before trying to install " \
                  "this package"
            for package, version in packages_not_found:
                print "* {} >= {}".format(package, version)
        else:
            _install.run(self)
Beispiel #18
0
    def run(self):
        def subst_file(_file, vars_2_subst):
            input_file = os.path.join(self.get_build_script(), _file)
            output_file = input_file + '.tmp'
            subst_vars(input_file, output_file, vars_2_subst)
            os.unlink(input_file)
            self.move_file(output_file, input_file)

        #TODO : ask to bertrand why he is not a problem in his setup.py in the same section
        # Obviously have to build before we can substitute PREFIXDATA and after install without build
        if not self.skip_build:
            self.run_command('build')
            # If we built for any other platform, we can't install.
            build_plat = self.distribution.get_command_obj('build').plat_name
            # check warn_dir - it is a clue that the 'install' is happening
            # internally, and not to sys.path, so we don't check the platform
            # matches what we are running.
            if self.warn_dir and build_plat != get_platform():
                raise DistutilsPlatformError("Can't install when "
                                             "cross-compiling")
            self.skip_build = 1

        inst = self.distribution.command_options.get('install')
        vars_2_subst = {'PREFIXDATA': os.path.join(get_install_data_dir(inst), 'regate'),
                        }
        for _file in self.distribution.fix_prefix:
            subst_file(_file, vars_2_subst)
        install.run(self)
Beispiel #19
0
    def run(self):
      version = get_version()
      cwd = os.getcwd()
      os.remove(cwd+"/db.sql")
      db = open(cwd+"/db.sql","w+")
      db.close()
    
        
      if os.path.isdir("/usr/local/lback"):
          shutil.rmtree("/usr/local/lback")

      os.makedirs("/usr/local/lback")
      os.makedirs("/usr/local/lback/backups/")
      links = [
            (cwd+"/lback/main.py", "/usr/bin/lback.py"),
            (cwd+"/lback/dal.py", "/usr/bin/dal.py"),
            (cwd+"/lback/odict.py", "/usr/bin/odict.py"),
            (cwd+"/bin/lback", "/usr/bin/lback"),
            (cwd+"/bin/lback-client", "/usr/bin/lback-client"),
            (cwd+"/bin/lback-server", "/usr/bin/lback-server"),
            (cwd+"/settings.json", "/usr/local/lback/settings.json"),
            (cwd+"/profiles.json", "/usr/local/lback/profiles.json"),
            (cwd+"/db.sql", "/usr/local/lback/db.sql")
        ]
      for i in links:
	 if os.path.islink(i[1]):
	      os.remove(i[1])
         subprocess.Popen(['ln', '-s', i[0], i[1]])
      install.run(self)
Beispiel #20
0
    def run(self):
        # Run the usual stuff.
        _install.run(self)

        # If --root wasn't specified default to /usr/local
        if self.root is None:
            self.root = "/usr/local"

        # Hand over some directories to the webserver user
        path = os.path.join(self.install_data, 'share/cobbler/web')
        try:
            self.change_owner(path, http_user)
        except KeyError as e:
            # building RPMs in a mock chroot, user 'apache' won't exist
            log.warn("Error in 'chown apache %s': %s" % (path, e))
        if not os.path.abspath(libpath):
            # The next line only works for absolute libpath
            raise Exception("libpath is not absolute.")
        # libpath is hardcoded in the code everywhere
        # therefor cant relocate using self.root
        path = os.path.join(libpath, 'webui_sessions')
        try:
            self.change_owner(path, http_user)
        except KeyError as e:
            log.warn("Error in 'chown apache %s': %s" % (path, e))
Beispiel #21
0
     def siteconfig(self):
         path = self.prefix or self.home
         path = os.path.expanduser(path)
         conf_dir = os.path.join(path, 'share', 'trac', 'conf')
         templates_dir = os.path.join(path, 'share', 'trac', 'templates')
         htdocs_dir = os.path.join(path, 'share', 'trac', 'htdocs')
         wiki_dir = os.path.join(path, 'share', 'trac', 'wiki-default')
         macros_dir = os.path.join(path, 'share', 'trac', 'wiki-macros')
         plugins_dir = os.path.join(path, 'share', 'trac', 'plugins')
         f = open(_p('trac/siteconfig.py'), 'w')
         f.write("""
# PLEASE DO NOT EDIT THIS FILE!
# This file was autogenerated when installing %(trac)s %(ver)s.
#
__default_conf_dir__ = %(conf)r
__default_templates_dir__ = %(templates)r
__default_htdocs_dir__ = %(htdocs)r
__default_wiki_dir__ = %(wiki)r
__default_macros_dir__ = %(macros)r
__default_plugins_dir__ = %(plugins)r

""" % {'trac': PACKAGE, 'ver': VERSION, 'conf': _p(conf_dir),
       'templates': _p(templates_dir), 'htdocs': _p(htdocs_dir),
       'wiki': _p(wiki_dir), 'macros': _p(macros_dir),
       'plugins': _p(plugins_dir)})
         f.close()

         # Run actual install
         install.run(self)
         print
         print "Thank you for choosing Trac %s. Enjoy your stay!" % VERSION
         print
Beispiel #22
0
    def setuptools_run(self):
        """ The setuptools version of the .run() method.

        We must pull in the entire code so we can override the level used in the
        _getframe() call since we wrap this call by one more level.
        """
        from distutils.command.install import install as distutils_install

        # Explicit request for old-style install?  Just do it
        if self.old_and_unmanageable or self.single_version_externally_managed:
            return distutils_install.run(self)

        # Attempt to detect whether we were called from setup() or by another
        # command.  If we were called by setup(), our caller will be the
        # 'run_command' method in 'distutils.dist', and *its* caller will be
        # the 'run_commands' method.  If we were called any other way, our
        # immediate caller *might* be 'run_command', but it won't have been
        # called by 'run_commands'.  This is slightly kludgy, but seems to
        # work.
        #
        caller = sys._getframe(3)
        caller_module = caller.f_globals.get('__name__', '')
        caller_name = caller.f_code.co_name

        if caller_module != 'distutils.dist' or caller_name!='run_commands':
            # We weren't called from the command line or setup(), so we
            # should run in backward-compatibility mode to support bdist_*
            # commands.
            distutils_install.run(self)
        else:
            self.do_egg_install()
Beispiel #23
0
 def run(self):
     build_py = self.distribution.get_command_obj("build_py")
     if self.distribution.packages:
         for package in self.distribution.packages:
             package_dir = build_py.get_package_dir(package)
             rmtree(os.path.join(self.install_lib, package_dir))
     install.run(self)
Beispiel #24
0
 def run(self):
     _install.run(self)
     import nltk
     try:
         nltk.data.find('tokenizers/punkt')
     except LookupError:
         nltk.download('punkt')
Beispiel #25
0
    def run(self):
        install.run(self)
        def rst2doc(lang):
            if os.path.exists(os.path.join('help', lang)):
                for doc in ('main_help', 'preferences_help'):
                    if os.path.exists(os.path.join('help', lang,'%s.rst' % doc)):
                        os.system("rst2html --stylesheet help/help.css help/%s/%s.rst > help/%s/%s.html" % (lang, doc, lang, doc))

        root_dir = "/usr/share"
        bin_dir = "/usr/bin"

        autostart_dir = os.path.join(bin_dir,"autostart")
        locale_dir = os.path.join(root_dir, "locale")
        apps_dir = os.path.join(root_dir, "applications")
        project_dir = os.path.join(root_dir, PROJECT)

        # Make directories
        print "Making directories..."
        makeDirs(bin_dir)
        makeDirs(locale_dir)
        makeDirs(apps_dir)
        makeDirs(project_dir)

        # Install desktop files
        print "Installing desktop files..."

        shutil.copy("data/%s.desktop" % PROJECT, apps_dir)

        shutil.rmtree('build/data')

        # Install codes
        print "Installing codes..."
        os.system("cp -R build/* %s/" % project_dir)

        # Install locales
        print "Installing locales..."
        for filename in glob.glob1("po", "*.po"):
            lang = filename.rsplit(".", 1)[0]
            rst2doc(lang)
            os.system("msgfmt po/%s.po -o po/%s.mo" % (lang, lang))
            makeDirs(os.path.join(locale_dir, "%s/LC_MESSAGES" % lang))
            shutil.copy("po/%s.mo" % lang, os.path.join(locale_dir, "%s/LC_MESSAGES" % lang, "%s.mo" % PROJECT))
        rst2doc('en')
        if os.path.exists("help"):
            print "Installing help files..."
            os.system("cp -R help %s/" % project_dir)

        # Modes
        print "Changing file modes..."
        os.chmod(os.path.join(project_dir, "%s.py" % PROJECT), 0755)

        # Symlink
        try:
            if self.root:
                os.symlink(os.path.join(project_dir.replace(self.root, ""), "%s.py" % PROJECT), os.path.join(bin_dir, PROJECT))
            else:
                os.symlink(os.path.join(project_dir, "%s.py" % PROJECT), os.path.join(bin_dir, PROJECT))
        except OSError:
            pass
Beispiel #26
0
    def run(self):
        install.run(self)

        if self.root:
            kde_dir = "%s/usr/kde/4" % self.root
        else:
            kde_dir = "/usr/kde/4"

        bin_dir = os.path.join(kde_dir, "bin")
        locale_dir = os.path.join(kde_dir, "share/locale")
        service_dir = os.path.join(kde_dir, "share/kde4/services")
        apps_dir = os.path.join(kde_dir, "share/applications/kde4")
        project_dir = os.path.join(kde_dir, "share/apps", about.appName)

        # Make directories
        print "Making directories..."
        makeDirs(bin_dir)
        makeDirs(locale_dir)
        makeDirs(service_dir)
        makeDirs(apps_dir)
        makeDirs(project_dir)

        # Install desktop files
        print "Installing desktop files..."
        self.copy_file("data/kcm_%s.desktop" % about.modName, service_dir)
        self.copy_file("data/kcm_displaydevices.desktop", service_dir)
        self.copy_file("data/%s.desktop" % about.modName, apps_dir)

        # Install codes
        print "Installing codes..."
        os.system("cp -R build/app/* %s/" % project_dir)

        # Install locales
        print "Installing locales..."
        for filename in glob.glob1("po", "*.po"):
            lang = filename.rsplit(".", 1)[0]
            os.system("msgfmt po/%s.po -o po/%s.mo" % (lang, lang))
            try:
                os.makedirs(os.path.join(locale_dir, "%s/LC_MESSAGES" % lang))
            except OSError:
                pass
            self.copy_file("po/%s.mo" % lang, os.path.join(locale_dir, "%s/LC_MESSAGES" % lang, "%s.mo" % about.catalog))

        # Rename
        #print "Renaming application.py..."
        #self.move_file(os.path.join(project_dir, "application.py"), os.path.join(project_dir, "%s.py" % about.appName))

        # Modes
        print "Changing file modes..."
        os.chmod(os.path.join(project_dir, "%s.sh" % about.appName), 0755)

        # Symlink
        try:
            if self.root:
                os.symlink(os.path.join(project_dir.replace(self.root, ""), "%s.sh" % about.appName), os.path.join(bin_dir, about.appName))
            else:
                os.symlink(os.path.join(project_dir, "%s.sh" % about.appName), os.path.join(bin_dir, about.appName))
        except OSError:
            pass
Beispiel #27
0
 def run(self):
     install.run(self)
     try:
         githash = open('.git/refs/heads/master').read()[:-1]
         system('sed -i /GITHASH/s/GITHASH/' + githash + '/ ' +
                path.join(self.install_scripts, 'schedule-jobs'))
     except IOError:
         pass
Beispiel #28
0
    def run(self):
        install.run(self)

        self.set_perms()
        self.set_modules_path()
        self.fix_paths()
        self.create_uninstaller()
        self.write_installed_files()
Beispiel #29
0
    def run(self):
        install.run(self)

        self.set_perms()
        self.set_modules_path()
        self.fix_paths()
        self.create_uninstaller()
        self.finish_banner()
Beispiel #30
0
    def run(self):
        "Run install process"

        if self.no_check_deps is None:
            self.check_dependencies()
    
        _install.run(self)
        self.normalize_record()
Beispiel #31
0
 def run(self):
     # Uncomment the line below if you want to check if the C library
     # is installed and in your path.
     # ret_val = self.check_extensions()
     lib_path = self.build_library('ccl')
     DistutilsInstall.run(self)
    def run(self):
        # Make sure the metadata has the conda attributes, even if the
        # distclass isn't CondaDistribution. We primarily do this to simplify
        # the code below.

        metadata = self.distribution.metadata

        for attr in CondaDistribution.conda_attrs:
            if not hasattr(metadata, attr):
                setattr(metadata, attr, CondaDistribution.conda_attrs[attr])

        # The command line takes precedence
        if self.buildnum is not None:
            metadata.conda_buildnum = self.buildnum

        with Locked(config.croot):
            d = defaultdict(dict)
            # Needs to be lowercase
            d['package']['name'] = metadata.name
            d['package']['version'] = metadata.version
            d['build']['number'] = metadata.conda_buildnum

            # MetaData does the auto stuff if the build string is None
            d['build']['string'] = metadata.conda_buildstr

            d['build']['binary_relocation'] = metadata.conda_binary_relocation
            d['build']['preserve_egg_dir'] = metadata.conda_preserve_egg_dir
            d['build']['features'] = metadata.conda_features
            d['build']['track_features'] = metadata.conda_track_features

            # XXX: I'm not really sure if it is correct to combine requires
            # and install_requires
            d['requirements']['run'] = d['requirements']['build'] = \
                [spec_from_line(i) for i in
                    (metadata.requires or []) +
                    (getattr(self.distribution, 'install_requires', []) or
                        [])] + ['python']
            if hasattr(self.distribution, 'tests_require'):
                # A lot of packages use extras_require['test'], but
                # tests_require is the one that is officially supported by
                # setuptools.
                d['test']['requires'] = [
                    spec_from_line(i)
                    for i in self.distribution.tests_require or []
                ]

            d['about']['home'] = metadata.url
            # Don't worry about classifiers. This isn't skeleton pypi. We
            # don't need to make this work with random stuff in the wild. If
            # someone writes their setup.py wrong and this doesn't work, it's
            # their fault.
            d['about']['license'] = metadata.license
            d['about']['summary'] = self.distribution.description

            # This is similar logic from conda skeleton pypi
            entry_points = getattr(self.distribution, 'entry_points', [])
            if entry_points:
                if isinstance(entry_points, string_types):
                    # makes sure it is left-shifted
                    newstr = "\n".join(x.strip()
                                       for x in entry_points.split('\n'))
                    c = configparser.ConfigParser()
                    entry_points = {}
                    try:
                        c.readfp(StringIO(newstr))
                    except Exception as err:
                        # This seems to be the best error here
                        raise DistutilsGetoptError(
                            "ERROR: entry-points not understood: " + str(err) +
                            "\nThe string was" + newstr)
                    else:
                        for section in config.sections():
                            if section in ['console_scripts', 'gui_scripts']:
                                value = [
                                    '%s=%s' %
                                    (option, config.get(section, option))
                                    for option in config.options(section)
                                ]
                                entry_points[section] = value
                            else:
                                # Make sure setuptools is added as a dependency below
                                entry_points[section] = None

                if not isinstance(entry_points, dict):
                    raise DistutilsGetoptError(
                        "ERROR: Could not add entry points. They were:\n" +
                        entry_points)
                else:
                    cs = entry_points.get('console_scripts', [])
                    gs = entry_points.get('gui_scripts', [])
                    # We have *other* kinds of entry-points so we need
                    # setuptools at run-time
                    if not cs and not gs and len(entry_points) > 1:
                        d['requirements']['run'].append('setuptools')
                        d['requirements']['build'].append('setuptools')
                    entry_list = cs + gs
                    if gs and conda.config.platform == 'osx':
                        d['build']['osx_is_app'] = True
                    if len(cs + gs) != 0:
                        d['build']['entry_points'] = entry_list
                        if metadata.conda_command_tests is True:
                            d['test']['commands'] = list(
                                map(unicode,
                                    pypi.make_entry_tests(entry_list)))

            if 'setuptools' in d['requirements']['run']:
                d['build']['preserve_egg_dir'] = True

            if metadata.conda_import_tests:
                if metadata.conda_import_tests is True:
                    d['test']['imports'] = (
                        (self.distribution.packages or []) +
                        (self.distribution.py_modules or []))
                else:
                    d['test']['imports'] = metadata.conda_import_tests

            if (metadata.conda_command_tests
                    and not isinstance(metadata.conda_command_tests, bool)):
                d['test']['commands'] = list(
                    map(unicode, metadata.conda_command_tests))

            d = dict(d)
            m = MetaData.fromdict(d)
            # Shouldn't fail, but do you really trust the code above?
            m.check_fields()
            build.build(m, post=False)
            # Do the install
            if not PY3:
                # Command is an old-style class in Python 2
                install.run(self)
            else:
                super().run()
            build.build(m, post=True)
            build.test(m)
            if self.binstar_upload:

                class args:
                    binstar_upload = self.binstar_upload

                handle_binstar_upload(build.bldpkg_path(m), args)
            else:
                no_upload_message = """\
# If you want to upload this package to binstar.org later, type:
#
# $ binstar upload %s
""" % build.bldpkg_path(m)
                print(no_upload_message)
Beispiel #33
0
 def run(self):
     install.run(self)
     from metakernel.utils import install_spec
     install_spec(kernel_json)
Beispiel #34
0
 def run(self):
     install.run(self)
     c = clean(self.distribution)
     c.all = True
     c.finalize_options()
     c.run()
Beispiel #35
0
 def run(self):
     self.pre_process()
     ret = install.run(self)
     self.post_process()
     self.create_pth()
     return ret
Beispiel #36
0
 def run(self):
     self.distribution.scripts = ['x-tile']
     install.run(self)
Beispiel #37
0
 def run(self):
     if not self.need_ext:
         log.info("Not Installing C Extension")
     else:
         log.info("Installing C Extension")
     install.run(self)
Beispiel #38
0
    def run(self):
        install.run(self)

        def rst2doc(lang):
            if os.path.exists(os.path.join('help', lang)):
                for doc in ('main_help', 'preferences_help'):
                    if os.path.exists(
                            os.path.join('help', lang, '%s.rst' % doc)):
                        os.system(
                            "rst2html --stylesheet help/help.css help/%s/%s.rst > help/%s/%s.html"
                            % (lang, doc, lang, doc))

        if self.root:
            root_dir = "%s/usr/share" % self.root
            bin_dir = os.path.join(self.root, "usr/bin")
        else:
            root_dir = "/usr/share"
            bin_dir = "/usr/bin"

        locale_dir = os.path.join(root_dir, "locale")
        mime_icons_dir = os.path.join(root_dir, "icons/hicolor")
        icon_dir = os.path.join(root_dir, "icons/hicolor/128x128/apps")
        json_dir = os.path.join(root_dir, "jsons")

        if FOR_KDE_4:
            apps_dir = os.path.join(root_dir, "applications/kde4")
            services_dir = os.path.join(root_dir, "kde4/services")
            project_dir = os.path.join(root_dir, "kde4/apps", PROJECT)
        else:
            apps_dir = os.path.join(root_dir, "applications")
            project_dir = os.path.join(root_dir, PROJECT)

        # Make directories
        print "Making directories..."
        makeDirs(mime_icons_dir)
        makeDirs(icon_dir)
        makeDirs(json_dir)
        makeDirs(bin_dir)
        makeDirs(locale_dir)
        makeDirs(apps_dir)
        makeDirs(project_dir)
        if FOR_KDE_4:
            makeDirs(services_dir)

        # Install desktop files
        print "Installing desktop files..."

        shutil.copy("data/%s.desktop" % PROJECT, apps_dir)
        if FOR_KDE_4:
            shutil.copy("data/kcm_%s.desktop" % PROJECT, services_dir)
        shutil.rmtree('build/data')

        for files in glob.glob("data/*.png"):
            shutil.copy(files, icon_dir)

## Install icons
#for size in ["16x16", "32x32", "48x48", "64x64"]:
#mime_size_dir = "%s/%s/mimetypes/" % (mime_icons_dir, size)
#makeDirs(mime_size_dir)
#shutil.copy("data/%s-%s.png" % (PROJECT, size), "%s/application-x-pisi.png" % mime_size_dir)

#Install json files
        for fileName in glob.glob("data/*.json"):
            shutil.copy(fileName, json_dir)

        # Install codes
        print "Installing codes..."
        os.system("cp -R build/* %s/" % project_dir)

        # Install locales
        print "Installing locales..."
        for filename in glob.glob1("po", "*.po"):
            lang = filename.rsplit(".", 1)[0]
            rst2doc(lang)
            os.system("msgfmt po/%s.po -o po/%s.mo" % (lang, lang))
            makeDirs(os.path.join(locale_dir, "%s/LC_MESSAGES" % lang))
            shutil.copy(
                "po/%s.mo" % lang,
                os.path.join(locale_dir, "%s/LC_MESSAGES" % lang,
                             "%s.mo" % PROJECT))
        rst2doc('en')
        if os.path.exists("help"):
            print "Installing help files..."
            os.system("cp -R help %s/" % project_dir)

        # Modes
        print "Changing file modes..."
        os.chmod(os.path.join(project_dir, "%s.py" % PROJECT), 0755)

        # Symlink
        try:
            if self.root:
                os.symlink(
                    os.path.join(project_dir.replace(self.root, ""),
                                 "%s.py" % PROJECT),
                    os.path.join(bin_dir, PROJECT))
            else:
                os.symlink(os.path.join(project_dir, "%s.py" % PROJECT),
                           os.path.join(bin_dir, PROJECT))
        except OSError:
            pass
Beispiel #39
0
 def run(self):
     """ Modified install procedure """
     _pre_install()
     print('*** Installing gate package ***')
     install.run(self)
     _post_install()
Beispiel #40
0
 def run(self):
     install.run(self)
     self.install_kernel_spec()
Beispiel #41
0
 def run(self):
     self.build_locales()
     _install.run(self)
Beispiel #42
0
 def run(self):
     if check_dependencies_once():
         # Run the normal install.
         install.run(self)
Beispiel #43
0
 def run(self):
     install.run(self)
     self.installi18n()
Beispiel #44
0
    def run(self):
        CAMBDIR = os.path.join(file_dir, '..')
        os.chdir(CAMBDIR)
        if platform.system() == "Windows":
            COMPILER = "gfortran"
            # note that TDM-GCC MingW 5.1 does not work due go general fortran bug.
            # This works: http://sourceforge.net/projects/mingw-w64/?source=typ_redirect
            # but need to use 32bit compiler to build 32 bit dll (contrary to what is implied)
            FFLAGS = "-shared -static -cpp -fopenmp -O3 -ffast-math -fmax-errors=4"
            if is32Bit: FFLAGS = "-m32 " + FFLAGS
            SOURCES = "constants.f90 utils.f90 subroutines.f90 inifile.f90 power_tilt.f90 recfast.f90 reionization.f90" \
                      " modules.f90 bessels.f90 equations.f90 halofit_ppf.f90 lensing.f90 SeparableBispectrum.f90 cmbmain.f90" \
                      " camb.f90 camb_python.f90"
            OUTPUT = r"-o pycamb\camb\%s" % DLLNAME
            scrs = os.listdir(os.getcwd())
            if not has_win_gfortran():
                print(
                    'WARNING: gfortran not in path (if you just installed you may need to log off and on again).'
                )
                print(
                    '         You can get a Windows gfortan build from http://sourceforge.net/projects/mingw-w64/'
                )
                print(
                    '         (get the %s version to match this python installation)'
                    % (('x86_64', 'i686')[is32Bit]))
                print(
                    'Using pre-compiled binaries instead - any local changes will be ignored...'
                )
                COPY = r'copy /Y pycamb\dlls\%s pycamb\camb\%s' % (
                    ('cambdll_x64.dll', DLLNAME)[is32Bit], DLLNAME)
                subprocess.call(COPY, shell=True)
            else:
                print(COMPILER + ' ' + FFLAGS + ' ' + SOURCES + ' ' + OUTPUT)
                subprocess.call(COMPILER + ' ' + FFLAGS + ' ' + SOURCES + ' ' +
                                OUTPUT,
                                shell=True)
            COPY = r"copy /Y HighLExtrapTemplate_lenspotentialCls.dat pycamb\camb"
            subprocess.call(COPY, shell=True)
            scrs.append(DLLNAME)
            if not osp.isfile('pycamb/camb/' + DLLNAME):
                sys.exit('Compilation failed')
            print("Removing temp files")
            nscrs = os.listdir(os.getcwd())
            for file in nscrs:
                if not file in scrs:
                    os.remove(file)

        else:
            print("Compiling source...")
            MAKE = "make camblib.so"
            subprocess.call(MAKE, shell=True)
            if not osp.isfile('pycamb/camb/camblib.so'):
                sys.exit('Compilation failed')
            CHOWN = "chmod 755 pycamb/camb/camblib.so"
            subprocess.call(CHOWN, shell=True)
            COPY = "cp HighLExtrapTemplate_lenspotentialCls.dat pycamb/camb"
            subprocess.call(COPY, shell=True)

        os.chdir(file_dir)
        install.run(self)
        print("Cleaning intermediate files...")
        if platform.system() == "Windows":
            DELETE = 'rmdir /s /q build'
        else:
            DELETE = 'rm -rf build'
        subprocess.call(DELETE, shell=True)
Beispiel #45
0
 def run(self):
     inst = self.distribution.command_options.get('install')
     install.run(self)
 def run(self):
     subprocess.call(['make', '-C', 'roi_pooling', 'build'])
     DistutilsInstall.run(self)
Beispiel #47
0
 def run(self):
     _install.run(self)
Beispiel #48
0
 def run(self):
     install.run(self)
     c = GurobiClean(self.distribution)
     c.finalize_options()
     c.run()
Beispiel #49
0
 def run(self):
     self.run_command('build_clib')
     install.run(self)
Beispiel #50
0
    def run(self):
        install.run(self)

        def rst2doc(lang):
            if os.path.exists(os.path.join('help', lang)):
                for doc in ('main_help', 'preferences_help'):
                    if os.path.exists(
                            os.path.join('help', lang, '%s.rst' % doc)):
                        os.system(
                            "rst2html --stylesheet help/help.css help/%s/%s.rst > help/%s/%s.html"
                            % (lang, doc, lang, doc))

        if self.root:
            root_dir = "%s/usr/share" % self.root
            bin_dir = os.path.join(self.root, "usr/bin")
        else:
            root_dir = "/usr/share"
            bin_dir = "/usr/bin"

        locale_dir = os.path.join(root_dir, "locale")
        if FOR_KDE_4:
            apps_dir = os.path.join(root_dir, "applications/kde4")
            services_dir = os.path.join(root_dir, "kde4/services")
            project_dir = os.path.join(root_dir, "kde4/apps", PROJECT)
        else:
            apps_dir = os.path.join(root_dir, "applications")
            project_dir = os.path.join(root_dir, PROJECT)

        # For Kde4 making services_dir
        if FOR_KDE_4:
            services_dir = os.path.join(root_dir, "kde4/services")
            makeDirs(services_dir)

        # Make directories
        print "Making directories..."
        makeDirs(bin_dir)
        makeDirs(locale_dir)
        makeDirs(apps_dir)
        makeDirs(project_dir)

        # Install desktop files
        print "Installing desktop files..."
        # Environment control for desktop files
        if FOR_KDE_4:
            shutil.copy("data/kcm_%s.desktop" % PROJECT, services_dir)
        else:
            shutil.copy("data/%s.desktop" % PROJECT, apps_dir)

        shutil.rmtree('build/data')

        # Install codes
        print "Installing codes..."
        os.system("cp -R build/* %s/" % project_dir)

        # Install locales
        print "Installing locales..."
        for filename in glob.glob1("po", "*.po"):
            lang = filename.rsplit(".", 1)[0]
            rst2doc(lang)
            os.system("msgfmt po/%s.po -o po/%s.mo" % (lang, lang))
            makeDirs(os.path.join(locale_dir, "%s/LC_MESSAGES" % lang))
            shutil.copy(
                "po/%s.mo" % lang,
                os.path.join(locale_dir, "%s/LC_MESSAGES" % lang,
                             "%s.mo" % PROJECT))
        rst2doc('en')
        if os.path.exists("help"):
            print "Installing help files..."
            os.system("cp -R help %s/" % project_dir)

        # Rename
        # print "Renaming application.py..."
        # shutil.move(os.path.join(project_dir, "main.py"), os.path.join(project_dir, "%s.py" % PROJECT))

        # Modes
        print "Changing file modes..."
        os.chmod(os.path.join(project_dir, "%s.py" % PROJECT), 0755)

        # Symlink
        try:
            if self.root:
                os.symlink(
                    os.path.join(project_dir.replace(self.root, ""),
                                 "%s.py" % PROJECT),
                    os.path.join(bin_dir, PROJECT))
            else:
                os.symlink(os.path.join(project_dir, "%s.py" % PROJECT),
                           os.path.join(bin_dir, PROJECT))
        except OSError:
            pass
Beispiel #51
0
 def run(self):
     install.run(self)
Beispiel #52
0
 def run(self):
     self._compile_parsego()
     return DistutilsInstall.run(self)
Beispiel #53
0
    def run(self):
        __migrate_database__()
        __create_custom_files__()

        install.run(self)
Beispiel #54
0
    def run(self):
        try:
            import wpath
        except ImportError:
            self.run_command('build')
            import wpath

        print("Using init file", (wpath.init, wpath.initfile))
        data.extend([
            (wpath.dbus, ['other/wicd.conf']),
            (wpath.dbus_service, ['other/org.wicd.daemon.service']),
            (wpath.systemd, ['other/wicd.service']),
            (wpath.logrotate, ['other/wicd.logrotate']),
            (wpath.log, [empty_file]),
            (wpath.etc, ['other/dhclient.conf.template.default']),
            (wpath.encryption, [('encryption/templates/' + b)
                                for b in os.listdir('encryption/templates')
                                if not b.startswith('.')]),
            (wpath.networks, [empty_file]), (wpath.sbin, ['scripts/wicd']),
            (wpath.daemon, [
                'wicd/monitor.py', 'wicd/wicd-daemon.py', 'wicd/suspend.py',
                'wicd/autoconnect.py'
            ]),
            (wpath.backends,
             ['wicd/backends/be-external.py', 'wicd/backends/be-ioctl.py']),
            (wpath.scripts, [empty_file]),
            (wpath.predisconnectscripts, [empty_file]),
            (wpath.postdisconnectscripts, [empty_file]),
            (wpath.preconnectscripts, [empty_file]),
            (wpath.postconnectscripts, [empty_file])
        ])

        if not wpath.no_install_gtk:
            data.append((wpath.desktop, ['other/wicd.desktop']))
            data.append((wpath.bin, ['scripts/wicd-client']))
            data.append((wpath.bin, ['scripts/wicd-gtk']))
            data.append((wpath.gtk, [
                'gtk/wicd-client.py',
                'gtk/netentry.py',
                'gtk/prefs.py',
                'gtk/gui.py',
                'gtk/guiutil.py',
                'data/wicd.ui',
                'gtk/configscript.py',
            ]))
            data.append((wpath.autostart, ['other/wicd-tray.desktop']))
            if not wpath.no_install_man:
                data.append((wpath.mandir + 'man1/', ['man/wicd-client.1']))
            for size in os.listdir('icons'):
                for category in os.listdir(os.path.join('icons', size)):
                    imgdir = os.path.join('icons', size, category)
                    data.append(
                        (os.path.join(wpath.icons, size,
                                      category), [(os.path.join(imgdir, f))
                                                  for f in os.listdir(imgdir)
                                                  if not f.startswith('.')]))
            for size in os.listdir('images'):
                for category in os.listdir(os.path.join('images', size)):
                    imgdir = os.path.join('images', size, category)
                    data.append(
                        (os.path.join(wpath.images, 'hicolor', size,
                                      category), [(os.path.join(imgdir, f))
                                                  for f in os.listdir(imgdir)
                                                  if not f.startswith('.')]))
            data.append((wpath.pixmaps, ['other/wicd-gtk.xpm']))
        if not wpath.no_install_gnome_shell_extensions:
            data.append(
                (wpath.gnome_shell_extensions + '*****@*****.**',
                 ['gnome-shell/' + f for f in os.listdir('gnome-shell')]))
        if not wpath.no_install_ncurses:
            data.append((wpath.curses, ['curses/curses_misc.py']))
            data.append((wpath.curses, ['curses/prefs_curses.py']))
            data.append((wpath.curses, ['curses/wicd-curses.py']))
            data.append((wpath.curses, ['curses/netentry_curses.py']))
            data.append((wpath.curses, ['curses/configscript_curses.py']))
            data.append((wpath.bin, ['scripts/wicd-curses']))
            if not wpath.no_install_man:
                data.append((wpath.mandir + 'man8/', ['man/wicd-curses.8']))
            if not wpath.no_install_man and not wpath.no_install_i18n_man:
                data.append(
                    (wpath.mandir + 'nl/man8/', ['man/nl/wicd-curses.8']))
            if not wpath.no_install_docs:
                data.append((wpath.docdir, ['curses/README.curses']))
        if not wpath.no_install_cli:
            data.append((wpath.cli, ['cli/wicd-cli.py']))
            data.append((wpath.bin, ['scripts/wicd-cli']))
            if not wpath.no_install_man:
                data.append((wpath.mandir + 'man8/', ['man/wicd-cli.8']))
            if not wpath.no_install_docs:
                data.append((wpath.docdir, ['cli/README.cli']))
        piddir = os.path.dirname(wpath.pidfile)
        if not piddir.endswith('/'):
            piddir += '/'
        if not wpath.no_install_docs:
            data.append((wpath.docdir, [
                'INSTALL',
                'LICENSE',
                'AUTHORS',
                'README',
                'CHANGES',
            ]))
            data.append((wpath.varlib, ['other/WHEREAREMYFILES']))
        if not wpath.no_install_kde:
            if not wpath.no_install_gtk:
                data.append((wpath.kdedir, ['other/wicd-tray.desktop']))
        if not wpath.no_install_init:
            data.append((wpath.init, [wpath.initfile]))
        if not wpath.no_install_man:
            data.append((wpath.mandir + 'man8/', ['man/wicd.8']))
            data.append(
                (wpath.mandir + 'man5/', ['man/wicd-manager-settings.conf.5']))
            data.append(
                (wpath.mandir + 'man5/', ['man/wicd-wired-settings.conf.5']))
            data.append((wpath.mandir + 'man5/',
                         ['man/wicd-wireless-settings.conf.5']))
            data.append((wpath.mandir + 'man1/', ['man/wicd-client.1']))
        if not wpath.no_install_man and not wpath.no_install_i18n_man:
            # Dutch translations of the man
            data.append((wpath.mandir + 'nl/man8/', ['man/nl/wicd.8']))
            data.append((wpath.mandir + 'nl/man5/',
                         ['man/nl/wicd-manager-settings.conf.5']))
            data.append((wpath.mandir + 'nl/man5/',
                         ['man/nl/wicd-wired-settings.conf.5']))
            data.append((wpath.mandir + 'nl/man5/',
                         ['man/nl/wicd-wireless-settings.conf.5']))
            data.append((wpath.mandir + 'nl/man1/', ['man/nl/wicd-client.1']))
        if not wpath.no_install_acpi:
            data.append((wpath.resume, ['other/80-wicd-connect.sh']))
            data.append((wpath.suspend, ['other/50-wicd-suspend.sh']))
        if not wpath.no_install_pmutils:
            data.append((wpath.pmutils, ['other/55wicd']))
        print('Using pid path', os.path.basename(wpath.pidfile))
        if not wpath.no_install_i18n:
            print('Language support for', end=' ')
            for language in sorted(glob('translations/*')):
                language = language.replace('translations/', '')
                print(language, end=' ')
                data.append(
                    (wpath.translations + language + '/LC_MESSAGES/',
                     ['translations/' + language + '/LC_MESSAGES/wicd.mo']))
        print()

        _install.run(self)
Beispiel #55
0
 def run(self):
     install.run(self)
     post_install()  # Does not work with pip
Beispiel #56
0
 def run(self):
     if path.exists('.git'):
         subprocess.check_call(['git', 'submodule', 'init'])
         subprocess.check_call(['git', 'submodule', 'update'])
         subprocess.check_call(['git', 'submodule', 'foreach', 'git', 'pull', 'origin', 'master'])
     install.run(self)
Beispiel #57
0
 def run(self):
     install.run(self)
     install.copy_tree(self, './man', os.path.join(self.prefix, 'man'))
Beispiel #58
0
 def run(self):
     self.distribution.scripts = ['cherrytree']
     install.run(self)
Beispiel #59
0
    def run(self):
        install.run(self)

        self.copy_file("build/data.rcc", os.path.join(self.root or "/", THEME_DIR))
Beispiel #60
0
 def run(self):
     install.run(self)
     if not DFT_AVAILABLE:
         print("****************************************************************")
         print("*** WARNING: DFT is not available.")
         print("****************************************************************")