Exemple #1
0
 def run(self):
     """Add pythonpath to pyclewn script in a 'home scheme' installation."""
     if pythonpath is not None and pythonpath not in sys.path:
         path_append = string.Template("sys.path.append('${pythonpath}')\n")
         self.executable += '\n\nimport sys\n'   \
                             + path_append.substitute(pythonpath=pythonpath)
     _build_scripts.run(self)
Exemple #2
0
    def run(self):
        build_scripts.run(self)

        for sfn in sfx_scripts:
            fixscript(sfn, self.build_dir, DEF_SUFFIX)
        for sfn in nosfx_scripts:
            fixscript(sfn, self.build_dir, DEF_NOSUFFIX)
    def run(self):
        global chromedriver_version, chromedriver_checksums

        validate = False

        if chromedriver_version:
            if chromedriver_checksums:
                validate = True
        else:
            chromedriver_version = get_chromedriver_version()

        file_name = 'chromedriver_{0}.zip'.format(chromedriver_version)
        zip_path = os.path.join(tempfile.gettempdir(), file_name)

        if validate:
            if os.path.exists(zip_path):
                print("\t - requested file '{0}' found at '{1}'."
                      .format(file_name, zip_path))

                if self._validate(zip_path):
                    print("\t - cached file '{0}' is valid.".format(zip_path))
                else:
                    print("\t - cached file '{0}' is not valid!"
                          .format(zip_path))
                    self._download(zip_path, validate=True)
            else:
                self._download(zip_path, validate=True)
        else:
            self._download(zip_path)

        self._unzip(zip_path)
        self.scripts = [os.path.join(self.build_dir, script) for script in
                        os.listdir(self.build_dir)]
        build_scripts.run(self)
    def run(self):
        global chromedriver_version, chromedriver_checksums

        validate = False

        if chromedriver_version:
            if chromedriver_checksums:
                validate = True
        else:
            chromedriver_version = get_chromedriver_version()

        file_name = 'chromedriver_{0}.zip'.format(chromedriver_version)
        zip_path = os.path.join(tempfile.gettempdir(), file_name)

        if validate:
            if os.path.exists(zip_path):
                print("\t - requested file '{0}' found at '{1}'."
                      .format(file_name, zip_path))

                if self._validate(zip_path):
                    print("\t - cached file '{0}' is valid.".format(zip_path))
                else:
                    print("\t - cached file '{0}' is not valid!".format(zip_path))
                    self._download(zip_path, validate=True)
            else:
                self._download(zip_path, validate=True)
        else:
            self._download(zip_path)

        self._unzip(zip_path)
        self.scripts = [os.path.join(self.build_dir, script) for script in
                        os.listdir(self.build_dir)]
        build_scripts.run(self)
Exemple #5
0
 def run(self):
     if sys.platform != 'win32':
         self.announce("create startup script")
         opj = os.path.join
         # Peek into "install" command to find out where it is going to install to
         inst_cmd = self.get_finalized_command('install')
         if inst_cmd:
             # Note: we user the "purelib" because we don't ship binary
             # executables. If we ever compile things into execs, we shall 
             # use "platlib"
             openerp_site_packages = opj(inst_cmd.install_purelib,'openerp-client')
             if inst_cmd.root and openerp_site_packages.startswith(inst_cmd.root):
                 # trick: when we install relative to root, we mostly mean to
                 # temporary put the files there, and then move back to the
                 # stripped prefix dir. So we don't write the full root into
                 # the script
                 iroot = inst_cmd.root
                 if iroot.endswith('/'):
                     iroot = iroot[:-1]
                 openerp_site_packages = openerp_site_packages[len(iroot):]
        
         else:
             # Hard-code the Linux /usr/lib/pythonX.Y/... path
             openerp_site_packages = opj('/usr', 'lib', 'python%s' % py_short_version, 'site-packages', 'openerp-client')
         start_script = "#!/bin/sh\ncd %s\nexec %s ./openerp-client.py $@\n" % (openerp_site_packages, sys.executable)
         # write script
         f = open('openerp-client', 'w')
         f.write(start_script)
         f.close()
     build_scripts.run(self)
Exemple #6
0
 def run(self):
     if sys.platform != 'win32':
         self.announce("create startup script")
         opj = os.path.join
         # Peek into "install" command to find out where it is going to install to
         inst_cmd = self.get_finalized_command('install')
         if inst_cmd:
             # Note: we user the "purelib" because we don't ship binary
             # executables. If we ever compile things into execs, we shall 
             # use "platlib"
             openerp_site_packages = opj(inst_cmd.install_purelib,'openerp-client')
             if inst_cmd.root and openerp_site_packages.startswith(inst_cmd.root):
                 # trick: when we install relative to root, we mostly mean to
                 # temporary put the files there, and then move back to the
                 # stripped prefix dir. So we don't write the full root into
                 # the script
                 iroot = inst_cmd.root
                 if iroot.endswith('/'):
                     iroot = iroot[:-1]
                 openerp_site_packages = openerp_site_packages[len(iroot):]
        
         else:
             # Hard-code the Linux /usr/lib/pythonX.Y/... path
             openerp_site_packages = opj('/usr', 'lib', 'python%s' % py_short_version, 'site-packages', 'openerp-client')
         start_script = "#!/bin/sh\ncd %s\nexec %s ./openerp-client.py $@\n" % (openerp_site_packages, sys.executable)
         # write script
         f = open('openerp-client', 'w')
         f.write(start_script)
         f.close()
     build_scripts.run(self)
Exemple #7
0
 def run(self):
     build_scripts.run(self)
     for f in os.listdir(self.build_dir):
         fpath = os.path.join(self.build_dir, f)
         if not fpath.endswith('.py'):
             if os.path.exists(fpath + '.py'):  os.unlink(fpath + '.py')
             os.rename(fpath, fpath + '.py')
Exemple #8
0
    def run(self):

        build_scripts.run(self)

        for sfn in sfx_scripts:
            fixscript(sfn, self.build_dir, DEF_SUFFIX)
        for sfn in nosfx_scripts:
            fixscript(sfn, self.build_dir, DEF_NOSUFFIX)
Exemple #9
0
 def run(self):
    if self.scripts is not None and "pychecker" in self.scripts:
       script_path = get_script_path(self.build_dir)
       self.scripts.remove("pychecker")
       self.scripts.append(script_path)
       self.mkpath(self.build_dir)
       self.execute(func=open, args=[script_path, "w"], msg="creating empty script %s" % script_path)
    build_scripts.run(self) # invoke "standard" action
Exemple #10
0
	def run(self):
		build_scripts_class.run(self)
		if os.name == 'posix' and not self.dry_run:
			for script in self.scripts:
				if script.endswith('.py'):
					file = os.path.join(self.build_dir, script)
					print 'renaming %s to %s' % (file, file[:-3])
					os.rename(file, file[:-3]) # len('.py') == 3
Exemple #11
0
 def run(self):
     build_scripts_class.run(self)
     if os.name == 'posix' and not self.dry_run:
         for script in self.scripts:
             if script.endswith('.py'):
                 file = os.path.join(self.build_dir, script)
                 print 'renaming %s to %s' % (file, file[:-3])
                 os.rename(file, file[:-3])  # len('.py') == 3
Exemple #12
0
 def run(self):
     build_scripts.run(self)
     for script in self.scripts:
         script = convert_path(script)
         outfile = join(self.build_dir, basename(script))
         if os.path.exists(outfile) and outfile.endswith(".py"):
             newfile = outfile[:-3]  # drop .py
             log.info("renaming %s -> %s", outfile, basename(newfile))
             os.rename(outfile, newfile)
Exemple #13
0
 def run(self):
     build_scripts.run(self)
     self.path_header = get_python_lib(prefix=prefix).replace(
         'dist-packages', 'site-packages')
     self.outfiles = [
         os.path.join(self.build_dir, os.path.basename(script))
         for script in self.distribution.scripts
     ]
     self.add_paths_to_scripts()
Exemple #14
0
 def run(self):
     build_scripts.run(self)
     for script in self.scripts:
         script = convert_path(script)
         outfile = join(self.build_dir, basename(script))
         if os.path.exists(outfile) and outfile.endswith(".py"):
             newfile = outfile[:-3] # drop .py
             log.info("renaming %s -> %s", outfile, basename(newfile))
             os.rename(outfile, newfile)
Exemple #15
0
 def run(self):
     self.distribution.scripts.append(os.path.join('bin',
                                                   'sage-env-config'))
     if not self.distribution.entry_points:
         self.entry_points = self.distribution.entry_points = dict()
     if 'console_scripts' not in self.distribution.entry_points:
         self.distribution.entry_points['console_scripts'] = []
     self.distribution.entry_points['console_scripts'].append(
         'sage-config=sage_conf:_main')
     distutils_build_scripts.run(self)
Exemple #16
0
    def run(self):
      cwd = os.getcwd()
      os.chdir(os.path.join(BASEPATH, 'bluepy'))
      cmd = ['make']

      def _make():
        call(cmd)
      self.execute(_make, [])
      os.chdir(cwd)
      build_scripts.run(self)
Exemple #17
0
 def run(self):
     build_scripts_class.run(self)
     if os.name == 'posix' and not self.dry_run:
         for script in self.scripts:
             fname, ext = os.path.splitext(script)
             if ext == '.py':
                 file = os.path.join(self.build_dir, script)
                 file_no_ext = os.path.join(self.build_dir, fname)
                 print 'renaming %s to %s' % (file, file_no_ext)
                 os.rename(file, file_no_ext)
Exemple #18
0
 def run(self):
     build_scripts_class.run(self)
     if os.name == 'posix' and not self.dry_run:
         for script in self.scripts:
             fname, ext = os.path.splitext(script)
             if ext == '.py':
                 file = os.path.join(self.build_dir, script)
                 file_no_ext = os.path.join(self.build_dir, fname)
                 print 'renaming %s to %s' % (file, file_no_ext)
                 os.rename(file, file_no_ext)
Exemple #19
0
 def run(self):
     build_scripts.run(self)
     for script in self.scripts:
         script = convert_path(script)
         outfile = join(self.build_dir, basename(script))
         if os.path.exists(outfile) and outfile.endswith(".py"):
             if basename(outfile) == "main.py":
                 dn, fn = split(outfile)
                 newfile = join(dn, "yumex-dnf")
                 log.info("renaming %s -> %s", outfile, basename(newfile))
                 os.rename(outfile, newfile)
Exemple #20
0
 def run(self):
     # Process the files list, stripping '.py' from script names.
     new_list = []
     for script in self.scripts:
         if script.endswith('.py'):
             self.copy_file(script, script[:-3])
             script = script[:-3]
         new_list.append(script)
     # Pass the processed list to the original build_scripts.run()
     self.scripts = new_list
     build_scripts.run(self)
Exemple #21
0
 def run (self):
     scripts = ['./scripts/cl-update-config']
     backup_build_dir = self.build_dir
     backup_scripts = filter(lambda x: not x in scripts, self.scripts)
     self.scripts = scripts
     self.build_dir = self.build_dir + "-bin"
     build_scripts.run(self)
     if backup_scripts:
         self.scripts = backup_scripts
         self.build_dir = backup_build_dir
         build_scripts.run(self)
Exemple #22
0
 def run (self):
     scripts = ['./scripts/proxy', './scripts/dhcp',
                './scripts/execserv']
     backup_build_dir = self.build_dir
     backup_scripts = filter(lambda x: not x in scripts, self.scripts)
     self.scripts = scripts
     self.build_dir = self.build_dir + "-bin"
     build_scripts.run(self)
     self.scripts = backup_scripts
     self.build_dir = backup_build_dir
     build_scripts.run(self)
Exemple #23
0
 def run(self):
     build_scripts.run(self)
     for script in self.scripts:
         script = convert_path(script)
         outfile = join(self.build_dir, basename(script))
         if os.path.exists(outfile) and outfile.endswith(".py"):
             if basename(outfile) in RENAME_SCRIPTS:
                 dn, fn = split(outfile)
                 newfile = join(dn, RENAME_SCRIPTS[fn])
                 log.info("renaming %s -> %s", outfile, basename(newfile))
                 os.rename(outfile, newfile)
Exemple #24
0
 def run(self):
     build_scripts.run(self)
     for script in self.scripts:
         script = convert_path(script)
         outfile = join(self.build_dir, basename(script))
         if os.path.exists(outfile) and outfile.endswith(".py"):
             if basename(outfile) in RENAME_SCRIPTS:
                 dn, fn = split(outfile)
                 newfile = join(dn, RENAME_SCRIPTS[fn])
                 log.info("renaming %s -> %s", outfile, basename(newfile))
                 os.rename(outfile, newfile)
Exemple #25
0
        def run(self):
            if 'Windows' in platform.system() or 'CYGWIN' in platform.system():
                os.system('gcc -o %sscripts/rlimit %ssrc/rlimit/rlimit-NT.c' %
                          (root_dir, root_dir))
            else:
                os.system('gcc -o %sscripts/rlimit %ssrc/rlimit/rlimit.c' %
                          (root_dir, root_dir))

            # Update the scripts list
            self.scripts += glob.glob(root_dir + 'scripts/rlimit*')

            build_scripts.run(self)
Exemple #26
0
    def run(self):
        build_scripts.run(self)

        self.run_command('build_ext')
        build_ext = self.get_finalized_command("build_ext")

        for ext in self.distribution.rust_extensions:
            if ext.binding == Binding.Exec:
                # GZ 2021-08-19: Not handling multiple binaries yet.
                os.replace(
                    os.path.join(build_ext.build_lib, ext.name),
                    os.path.join(self.build_dir, ext.name))
Exemple #27
0
 def run(self):
     _build_scripts.run(self)
     if self.scripts and os.name == "nt":
         # Make sure that all installed scripts have .py extension
         for file in self.scripts:
             file = convert_path(file)
             file = os.path.join(self.build_dir, os.path.basename(file))
             root, ext = os.path.splitext(file)
             path = root + ".py"
             if os.path.exists(path):
                 os.remove(file)
             else:
                 self.move_file(file, path)
Exemple #28
0
 def run(self):
     _build_scripts.run(self)
     if self.scripts and os.name == "nt":
         # Make sure that all installed scripts have .py extension
         for file in self.scripts:
             file = convert_path(file)
             file = os.path.join(self.build_dir, os.path.basename(file))
             root, ext = os.path.splitext(file)
             path = root + ".py"
             if os.path.exists(path):
                 os.remove(file)
             else:
                 self.move_file(file, path)
Exemple #29
0
    def run(self):
        from umdinst.setup import gen_config, gen_wrappers

        env = self.distribution.get_command_obj("install")
        # First, check to make sure the javapath is valid
        if env.with_hackystat:
            if (env.javapath is not None) and (env.javapath is not "") and not os.access(env.javapath, os.X_OK):
                # raise ValueError, "Could not find java executable in 'javapath' specified in config: " + env.javapath + "\nSpecify a valid java executable with the '--javapath=' option or disable Hackystat with the '--without-hackystat' option."
                print "Error: could not find java executable in 'javapath' specified in config: " + env.javapath + "\nSpecify a valid java executable with the '--javapath=' option or disable Hackystat with the '--without-hackystat' option."
                sys.exit(-1)

        # Sanity check, make sure there's a keyfile, or setup will fail for now
        if not os.path.exists(os.path.join("conf", env.keyfile)):
            raise ValueError, "Cannot locate keyfile (%s) which is needed for installation." % env.keyfile

        # Sanity check, make sure there's a askfile, or setup will fail for now
        if not os.path.exists(os.path.join("conf", env.whitelistfile)):
            raise ValueError, "Cannot locate askfile (%s) which is needed for installation." % env.whitelistfile

        # Generate the config file for runtime
        platform_specific_file = os.path.join("scripts", "wrapper", "platform_specific.py")
        gen_config.gen_platform_specific_config(env, platform_specific_file)

        # Generate the wrapper scripts
        absprefix = os.path.abspath(env.prefix)
        version = "%d.%d" % sys.version_info[:2]
        libpath = """%s/lib/python%s/site-packages""" % (absprefix, version)
        gen_wrappers.gen_wrappers(env, libpath)

        if env.with_pooledlog:
            logfiledir = os.path.join(absprefix, ".data")
            self.createdir(logfiledir)
            from stat import S_IRWXU, S_IRWXG, S_IRWXO

            os.chmod(logfiledir, S_IRWXU | S_IRWXG | S_IRWXO)
            print """changing mode of %s to 777 for pooled logging""" % logfiledir

        # from umdinst.setup import autobackup
        # autobackup.launch_backup_daemon()

        # Finally, a dirty trick to add dynamically generated scripts
        # to the script list
        self.scripts = self.scripts + [
            "scripts/wrapper/" + x for x in os.listdir("scripts/wrapper/") if not os.path.isdir(x)
        ]

        # Run the default build_script.run() method
        build_scripts.run(self)
    def run (self):
        if not self.scripts:
            return

        self.scripts = self.generate_scripts(self.scripts)

        return old_build_scripts.run(self)
 def run(self):
     self.mkpath(self.build_dir)
     must_clean = []
     for _file in self.distribution.viewer:
         #if the link already exists (build already ran don't try to create it
         if not os.path.exists(_file):
             macsyview_src = os.path.join('macsyview', _file)
             if os.path.exists(macsyview_src):
                 os.symlink(os.path.abspath(os.path.join('macsyview', _file)), _file)
                 must_clean.append(_file)
                 self.scripts += self.viewer
             else:
                 log.warn("macsyview not found")
     _build_scripts.run(self)
     for _link in must_clean:
         os.unlink(_link)
        def run(self):

            # Do the default actions.
            base.run(self)
            # Work around distutils bug (for python > 2.3)
            # change permissions to executable.
            for s in self.scripts:
                script = os.path.join(self.build_dir, os.path.basename(s))

                if self.dry_run:
                    self.announce("changing mode of %s"%script)
                else:
                    oldmode = os.stat(script)[ST_MODE] & int('7777', 8)
                    newmode = (oldmode | int('555', 8)) & int('7777', 8)
                    if newmode != oldmode:
                        self.announce("changing mode of %s from %o to %o"%(script, oldmode, newmode)),
                        os.chmod(script, newmode)
Exemple #33
0
 def run(self):
     self.mkpath(self.build_dir)
     must_clean = []
     for _file in self.distribution.viewer:
         #if the link already exists (build already ran don't try to create it
         if not os.path.exists(_file):
             macsyview_src = os.path.join('macsyview', _file)
             if os.path.exists(macsyview_src):
                 os.symlink(
                     os.path.abspath(os.path.join('macsyview', _file)),
                     _file)
                 must_clean.append(_file)
                 self.scripts += self.viewer
             else:
                 log.warn("macsyview not found")
     _build_scripts.run(self)
     for _link in must_clean:
         os.unlink(_link)
Exemple #34
0
        def run(self):

            # Do the default actions.
            base.run(self)
            # Work around distutils bug (for python > 2.3)
            # change permissions to executable.
            for s in self.scripts:
                script = os.path.join(self.build_dir, os.path.basename(s))

                if self.dry_run:
                    self.announce("changing mode of %s" % script)
                else:
                    oldmode = os.stat(script)[ST_MODE] & int('7777', 8)
                    newmode = (oldmode | int('555', 8)) & int('7777', 8)
                    if newmode != oldmode:
                        self.announce("changing mode of %s from %o to %o" %
                                      (script, oldmode, newmode)),
                        os.chmod(script, newmode)
    def run(self):
        global geckodriver_version, geckodriver_checksums

        if not geckodriver_version:
            geckodriver_version = get_geckodriver_version()

        file_name = 'geckodriver_{version}.{compression}'.format(
            version=geckodriver_version,
            compression=self._get_compression_suffix())
        zip_path = os.path.join(tempfile.gettempdir(), file_name)

        self._download(zip_path)

        self._unzip(zip_path)
        self.scripts = [
            os.path.join(self.build_dir, script)
            for script in os.listdir(self.build_dir)
        ]
        build_scripts.run(self)
Exemple #36
0
    def run(self):
        if not self.scripts:
            return

        self.scripts = self.generate_scripts(self.scripts)
        # Now make sure that the distribution object has this list of scripts.
        # setuptools' develop command requires that this be a list of filenames,
        # not functions.
        self.distribution.scripts = self.scripts

        return old_build_scripts.run(self)
    def run (self):
        if not self.scripts:
            return

        self.scripts = self.generate_scripts(self.scripts)
        # Now make sure that the distribution object has this list of scripts.
        # setuptools' develop command requires that this be a list of filenames,
        # not functions.
        self.distribution.scripts = self.scripts

        return old_build_scripts.run(self)
Exemple #38
0
    def run(self):
        # Not in posix system. Add prefix .py just to be sure
        if os.name != "posix":
            self.distribution.add_prefix = True
        # Remove .py prefix in posix. 
        elif os.name == "posix" and not self.distribution.add_prefix:
            self.distribution.remove_prefix = True

        try:
            tempdir = mkdtemp()
            new_names = []
            for script in self.scripts:
                new_name = os.path.join(tempdir,self._transform_script_name(script))
                new_names.append(new_name)
                copyfile(script,new_name)

            self.scripts = new_names
            build_scripts.run(self)
        finally:
            if os.path.isdir(tempdir):
                rmtree(tempdir)
Exemple #39
0
    def run(self):
        from distutils import log

        if not self.scripts:
            return

        saved_scripts = self.scripts
        self.scripts = []
        for script in saved_scripts:
            script = distutils.util.convert_path(script)
            script_copy, script_ext = os.path.splitext(script)

            if script_ext != '.py':
                log.debug("Not removing extension from %s since it's not '.py'", script)
            else:
                log.debug("Copying %s -> %s", script, script_copy)
                self.copy_file(script, script_copy)
                self.scripts.append(script_copy)
        # distutils is compatible with 2.1 so we cannot use super() to
        # call it.
        _build_scripts.run(self)
        self.scripts = saved_scripts
Exemple #40
0
    def run(self):
        # Not in posix system. Add prefix .py just to be sure
        if os.name != "posix":
            self.distribution.add_prefix = True
        # Remove .py prefix in posix.
        elif os.name == "posix" and not self.distribution.add_prefix:
            self.distribution.remove_prefix = True

        try:
            tempdir = mkdtemp()
            new_names = []
            for script in self.scripts:
                new_name = os.path.join(tempdir,
                                        self._transform_script_name(script))
                new_names.append(new_name)
                copyfile(script, new_name)

            self.scripts = new_names
            build_scripts.run(self)
        finally:
            if os.path.isdir(tempdir):
                rmtree(tempdir)
    def run(self):
        global chromedriver_version, chromedriver_checksums

        # validate = False

        # if chromedriver_version:
        #     if chromedriver_checksums:
        #         validate = True
        # else:
        #     chromedriver_version = get_chromedriver_version()

        # file_name = 'chromedriver_{0}.zip'.format(chromedriver_version)
        # zip_path = os.path.join(tempfile.gettempdir(), file_name)
        # print('--------------------')
        # print(zip_path)
        # print('--------------------')
        # if validate:
        #     if os.path.exists(zip_path):
        #         print("\t - requested file '{0}' found at '{1}'."
        #               .format(file_name, zip_path))

        #         if self._validate(zip_path):
        #             print("\t - cached file '{0}' is valid.".format(zip_path))
        #         else:
        #             print("\t - cached file '{0}' is not valid!"
        #                   .format(zip_path))
        #             self._download(zip_path, validate=True)
        #     else:
        #         self._download(zip_path, validate=True)
        # else:
        zip_path = '/tmp/chromedriver_{}.zip'.format(version)
        self._download(zip_path)

        self._unzip(zip_path)
        self.scripts = [
            os.path.join(self.build_dir, script)
            for script in os.listdir(self.build_dir)
        ]
        build_scripts.run(self)
Exemple #42
0
    def run(self):
        if os.name != 'nt':
            return build_scripts.run(self)

        exebuilt = False
        try:
            self.run_command('build_hgexe')
            exebuilt = True
        except (DistutilsError, CCompilerError):
            log.warn('failed to build optional hg.exe')

        if exebuilt:
            # Copying hg.exe to the scripts build directory ensures it is
            # installed by the install_scripts command.
            hgexecommand = self.get_finalized_command('build_hgexe')
            dest = os.path.join(self.build_dir, 'hg.exe')
            self.mkpath(self.build_dir)
            self.copy_file(hgexecommand.hgexepath, dest)

            # Remove hg.bat because it is redundant with hg.exe.
            self.scripts.remove('contrib/win32/hg.bat')

        return build_scripts.run(self)
Exemple #43
0
    def run(self):
        if not self.scripts:
            return

        saved_scripts = self.scripts
        self.scripts = []
        for script in saved_scripts:
            script = distutils.util.convert_path(script)
            script_copy, script_ext = os.path.splitext(script)

            if script_ext != '.py':
                log.debug("Not removing extension from {script} "
                          "since it's not '.py'".format(script=script))
            else:
                log.debug("Copying {orig} -> {dest}".format(orig=script,
                                                            dest=script_copy))
                self.copy_file(script, script_copy)
                self.scripts.append(script_copy)
        # distutils is compatible with 2.1 so we cannot use super() to
        # call it.
        _build_scripts.run(self)
        self.outfiles = self.scripts
        self.scripts = saved_scripts
Exemple #44
0
    def run(self):
        if os.name != 'nt' or self.distribution.pure:
            return build_scripts.run(self)

        exebuilt = False
        try:
            self.run_command('build_hgexe')
            exebuilt = True
        except (DistutilsError, CCompilerError):
            log.warn('failed to build optional hg.exe')

        if exebuilt:
            # Copying hg.exe to the scripts build directory ensures it is
            # installed by the install_scripts command.
            hgexecommand = self.get_finalized_command('build_hgexe')
            dest = os.path.join(self.build_dir, 'hg.exe')
            self.mkpath(self.build_dir)
            self.copy_file(hgexecommand.hgexepath, dest)

            # Remove hg.bat because it is redundant with hg.exe.
            self.scripts.remove('contrib/win32/hg.bat')

        return build_scripts.run(self)
Exemple #45
0
    def run(self):
        if not self.scripts:
            return

        saved_scripts = self.scripts
        self.scripts = []
        for script in saved_scripts:
            script = distutils.util.convert_path(script)
            script_copy, script_ext = os.path.splitext(script)

            if script_ext != '.py':
                log.debug("Not removing extension from {script} "
                          "since it's not '.py'".format(script=script))
            else:
                log.debug("Copying {orig} -> {dest}".format(
                    orig=script, dest=script_copy))
                self.copy_file(script, script_copy)
                self.scripts.append(script_copy)
        # distutils is compatible with 2.1 so we cannot use super() to
        # call it.
        _build_scripts.run(self)
        self.outfiles = self.scripts
        self.scripts = saved_scripts
Exemple #46
0
    def run (self):
        "change PYTHON_PATH for DAMARIS executable"
        _build_scripts.run(self)
        script="scripts/DAMARIS"
        script = convert_path(script)
        outfile = os.path.join(self.build_dir, os.path.basename(script))
        self.damaris_dir=os.path.normpath(self.damaris_dir)
        if self.damaris_dir in sys.path:
            log.debug("not changing %s (this path is on standard path)", script)
            # nothing to do for us
            return

        # now change PATH in DAMARIS script
        # copy backup
        log.info("adapting DAMARIS script to use local installation")
        shutil.copyfile(outfile, outfile+".bak")
        # the file should keep all its attributes (executable...)
        inf=file(outfile+".bak","r")
        outf=file(outfile,"w")
        l=inf.readline()
        while not l.startswith("import sys") and l!="":
            outf.write(l)
            l=inf.readline()

        if l!="":
            outf.write(l)
            l=inf.readline()
            while l.endswith("# inserted by setup.py\n"):
                l=inf.readline()
            outf.write("sys.path.insert(0,\"%s\") # inserted by setup.py\n"%self.damaris_dir)
            outf.write(l)
        
        outf.writelines(inf.readlines())
        inf.close()
        outf.close()
        os.remove(outfile+".bak")
Exemple #47
0
 def run(self):
     versions = versioneer.get_versions()
     tempdir = tempfile.mkdtemp()
     generated = os.path.join(tempdir, "rundemo")
     with open(generated, "wb") as f:
         for line in open("src/rundemo-template", "rb"):
             if line.strip().decode("ascii") == "#versions":
                 f.write(('versions = %r\n' % (versions,)).encode("ascii"))
             else:
                 f.write(line)
     self.scripts = [generated]
     rc = build_scripts.run(self)
     os.unlink(generated)
     os.rmdir(tempdir)
     return rc
Exemple #48
0
    def run(self):
        build_scripts.finalize_options(self)

        # fixup scripts to look in the build_ext output folder
        if self.scripts:
            build_ext = self.get_finalized_command("build_ext")
            output_dir = os.path.dirname(build_ext.get_ext_fullpath("clr"))
            scripts = []
            for script in self.scripts:
                if os.path.exists(os.path.join(output_dir, script)):
                    script = os.path.join(output_dir, script)
                scripts.append(script)
            self.scripts = scripts

        return build_scripts.run(self)
Exemple #49
0
 def run(self):
     versions = versioneer.get_versions()
     tempdir = tempfile.mkdtemp()
     generated = os.path.join(tempdir, "git-annex-remote-googledrive")
     with open(generated, "wb") as f:
         for line in open("git-annex-remote-googledrive", "rb"):
             if line.strip().decode("ascii") == "versions = None":
                 f.write('versions = {}\n'.format(versions).encode("ascii"))
             else:
                 f.write(line)
     self.scripts = [generated]
     rc = build_scripts.run(self)
     os.unlink(generated)
     os.rmdir(tempdir)
     return rc
Exemple #50
0
    def run(self):
        from distutils import log

        if not self.scripts:
            return

        saved_scripts = self.scripts
        self.scripts = []
        for script in saved_scripts:
            script = distutils.util.convert_path(script)
            script_copy, script_ext = os.path.splitext(script)

            if script_ext != '.py':
                log.debug(
                    "Not removing extension from %s since it's not '.py'",
                    script)
            else:
                log.debug("Copying %s -> %s", script, script_copy)
                self.copy_file(script, script_copy)
                self.scripts.append(script_copy)
        # distutils is compatible with 2.1 so we cannot use super() to
        # call it.
        _build_scripts.run(self)
        self.scripts = saved_scripts
Exemple #51
0
    def run(self):
        build_scripts.finalize_options(self)

        # fixup scripts to look in the build_ext output folder
        if self.scripts:
            build_ext = self.get_finalized_command("build_ext")
            output_dir = os.path.dirname(build_ext.get_ext_fullpath("clr"))
            scripts = []
            for script in self.scripts:
                if os.path.exists(os.path.join(output_dir, script)):
                    script = os.path.join(output_dir, script)
                scripts.append(script)
            self.scripts = scripts

        return build_scripts.run(self)
Exemple #52
0
    def run(self):
        version = versioneer.get_version()
        add_literal_substitution("version", 'version = "%s"\n' % version)
        add_substitution("ed25519", "ed25519.py")
        add_base64_substitution("setup-lockup-b64", "setup-lockup.py")
        tempdir = tempfile.mkdtemp()
        git_lockup = os.path.join(tempdir, "git-lockup")
        with open(git_lockup, "wb") as f:
            f.write(construct("git-lockup-template"))

        # modify self.scripts with the source pathname of scripts to install
        # into self.build_dir . When we upcall, those scripts will be copied
        # and adjusted (their shbang line set to sys.executable).
        self.scripts = [git_lockup]
        rc = build_scripts.run(self)
        os.unlink(git_lockup)
        os.rmdir(tempdir)
        return rc
Exemple #53
0
    def run(self):
        version = versioneer.get_version()
        add_literal_substitution("version", 'version = "%s"\n' % version)
        add_substitution("ed25519", "ed25519.py")
        add_base64_substitution("setup-lockup-b64", "setup-lockup.py")
        tempdir = tempfile.mkdtemp()
        git_lockup = os.path.join(tempdir, "git-lockup")
        with open(git_lockup, "wb") as f:
            f.write(construct("git-lockup-template"))

        # modify self.scripts with the source pathname of scripts to install
        # into self.build_dir . When we upcall, those scripts will be copied
        # and adjusted (their shbang line set to sys.executable).
        self.scripts = [git_lockup]
        rc = build_scripts.run(self)
        os.unlink(git_lockup)
        os.rmdir(tempdir)
        return rc
Exemple #54
0
    def run(self):
        v = generate_versioneer_py()
        v_b64 = base64.b64encode(v).decode("ascii")
        lines = [v_b64[i:i+60] for i in range(0, len(v_b64), 60)]
        v_b64 = "\n".join(lines)+"\n"

        with open("src/installer.py") as f:
            s = f.read()
        s = ver(s.replace("@VERSIONEER-INSTALLER@", v_b64))

        tempdir = tempfile.mkdtemp()
        installer = os.path.join(tempdir, "versioneer")
        with open(installer, "w") as f:
            f.write(s)

        self.scripts = [installer]
        rc = build_scripts.run(self)
        os.unlink(installer)
        os.rmdir(tempdir)
        return rc
    def run(self):
        v = generate_versioneer_py()
        v_b64 = base64.b64encode(v).decode("ascii")
        lines = [v_b64[i:i + 60] for i in range(0, len(v_b64), 60)]
        v_b64 = "\n".join(lines) + "\n"

        with open("src/installer.py") as f:
            s = f.read()
        s = ver(s.replace("@VERSIONEER-INSTALLER@", v_b64))

        tempdir = tempfile.mkdtemp()
        installer = os.path.join(tempdir, "versioneer")
        with open(installer, "w") as f:
            f.write(s)

        self.scripts = [installer]
        rc = build_scripts.run(self)
        os.unlink(installer)
        os.rmdir(tempdir)
        return rc