コード例 #1
0
ファイル: builder.py プロジェクト: ATNF/askapsoft
    def _release(self):
        '''
        Create a tarball of the staged location.
        The rbuild program has -N option that stops the adding of virtualenv
        to the release.  This is for developers sharing purely python packages.
        In this case there is no point creating the release envfile and
        cannot update the easy-install.pth file.
        '''
        utils.q_print("info: running the release process")
        utils.q_print(
            "info: resetting python scripts to use '#!/usr/bin/env python'")
        bindir = os.path.join(self._stagedir, "bin")
        for fn in glob.glob("%s/*" % bindir):
            sedcmd = "sed -i -e '1s&^#\!.*/bin/python&#\!/usr/bin/env python&' %s" % fn
            utils.runcmd(sedcmd, shell=True)

        if os.path.exists(os.path.join(self._stagedir, "bin", "python")):
            self._create_release_envfile()
            self._update_easyinstall()
        dn, bn = os.path.split(self._stagedir.rstrip("/"))
        if not dn:
            dn = '.'
        utils.q_print("info: creating %s.tgz" % self._releasename)
        utils.runcmd("tar -C %s -czf %s.tgz %s" % (dn, self._releasename, bn))
        utils.rmtree(self._stagedir)
コード例 #2
0
ファイル: builder.py プロジェクト: ATNF/askapsoft
    def _clean(self):
        cpaths = list(self._clean_targets) + \
            [self._pkgsig, self._installdir, ".sconsign.dblite"]
        if os.path.exists(self._infofile):
            with open(self._infofile, "r") as fh:
                if fh.readline().find("# Auto-generated by build.py") >= 0:
                    cpaths.append(self._infofile)
        if not utils.in_code_tree():
            cpaths += [self._package]

        if os.path.exists(self._clean_file):
            with open(self._clean_file, "r") as fh:
                for line in fh:
                    cpaths.append(line.strip())
        cpaths.append(self._clean_file)

        for path in cpaths:
            if os.path.exists(path):
                utils.rmtree(path)
        return True
コード例 #3
0
ファイル: build.py プロジェクト: ATNF/askapsdp
repdict = {'Makefile'                    : top_m,
           'cpp/config/Make.rules'       : cpp_mr,
           'py/config/Make.rules'        : py_mr,
           'py/config/Make.rules.Darwin' : py_mrd,
           'java/config/build.properties': java_bp,
           'java/build.xml': java_ant}

platform = utils.get_platform()

for filename in repdict.keys():
    for r_tuple in repdict[filename]:
        builder.replace(filename, *r_tuple) # '*' operator - unpack the tuple.

builder.parallel = False
builder.nowarnings = True

builder.build()


# The first build installs python just as files in directory 'python'.
# We want it installed as egg.
utils.rmtree(os.path.join(builder._prefix, "python"))

builder2 = Builder2(buildsubdir='py')

builder2.add_file('files/setup.py', 'py')
builder2.add_file('files/setup.cfg', 'py')
builder2.do_clean = False

builder2.build()
コード例 #4
0
ファイル: builder.py プロジェクト: ATNF/askapsoft
 def build(self):
     '''
     Run the complete build process.
     XXX rbuild script only allows single build targets to be specified
         but 'python build.py <targets>' allows for multiple targets
         to be specified.
     '''
     # get tar file name in case of a remote archive
     self._determine_tarfile()
     if "bclean" in self._comopts:
         self._build_clean()
     if "clean" in self._comopts:
         self._clean()  # will remove .packagesig
     if "depends" in self._comopts:
         pass  # handled by rbuild but for completeness list here.
     if "install" in self._comopts:
         if self.is_up_to_date():
             return
         # Run clean before building to get rid of possible old artifacts
         # in installdir.
         # The do_clean flag should only be set False for second builders.
         # In Code just remove the installdir rather than running _clean()
         # so rebuilds will be fast and handled by underlying build
         # system e.g. scons
         if self.do_clean:
             if utils.in_code_tree():
                 if os.path.exists(self._installdir):
                     utils.q_print("info:    pre-build removal of %s dir." %
                                   self._installdir)
                     utils.rmtree(self._installdir)
             else:
                 utils.q_print("info:    pre-build clean.")
                 self._clean()
         self._get_system_opts()
         self._fetch_remote()
         self._unpack()
         self._copy(self._files, self._package)
         self._patch()
         self._replace()
         self._precommand()
         os.chdir(self._builddir)
         self._configure()
         self._build()
         self._install()
         os.chdir(self._bdir)
         self._copy_to_install()
         self._lib64_symlink()
         self._create_info()
         self._create_init()
         self._postcommand()
         self._signature()
         self._save_clean_targets()
     if "test" in self._comopts and utils.in_code_tree():
         os.chdir(self._package)
         self._test()
         os.chdir(self._bdir)
     if "functest" in self._comopts and utils.in_code_tree():
         os.chdir(self._package)
         self._functest()
         os.chdir(self._bdir)
     if "signature" in self._comopts:
         self._signature()
     if "stage" in self._comopts:
         self._stage()
     if "release" in self._comopts:
         self._release()
     if "deploy" in self._comopts:
         self._deploy()
     if "format" in self._comopts:
         if utils.in_code_tree():
             utils.format_src_code()
         else:
             utils.q_print("warn: format only applies in the Code tree.")
     if "doc" in self._comopts:
         os.chdir(self._package)
         self._doc()
         os.chdir(self._bdir)
コード例 #5
0
ファイル: builder.py プロジェクト: ATNF/askapsoft
 def _build_clean(self):
     for path in [self._package]:
         if os.path.exists(path):
             utils.rmtree(path)
コード例 #6
0
    'Makefile': top_m,
    'cpp/config/Make.rules': cpp_mr,
    'py/config/Make.rules': py_mr,
    'py/config/Make.rules.Darwin': py_mrd,
    'java/config/build.properties': java_bp,
    'java/build.xml': java_ant
}

platform = utils.get_platform()

for filename in repdict.keys():
    for r_tuple in repdict[filename]:
        builder.replace(filename, *r_tuple)  # '*' operator - unpack the tuple.

builder.parallel = False
builder.nowarnings = True

builder.build()

# The first build installs python just as files in directory 'python'.
# We want it installed as egg.
utils.rmtree(os.path.join(builder._prefix, "python"))

builder2 = Builder2(buildsubdir='py')

builder2.add_file('files/setup.py', 'py')
builder2.add_file('files/setup.cfg', 'py')
builder2.do_clean = False

builder2.build()