コード例 #1
0
ファイル: make.py プロジェクト: ndparker/wolfe
    def _check_committed(self):
        """ Check if everything is committed """
        git = shell.frompath('git')
        lines = shell.spawn(
            git, 'branch', '--color=never',
            stdout=True, env=dict(_os.environ, LC_ALL='C')
        ).splitlines()
        for line in lines:
            if line.startswith('*'):
                branch = line.split(None, 1)[1]
                break
        else:
            make.fail("Could not determine current branch.")
        if branch != 'master':
            rex = _re.compile(r'^\d+(?:\.\d+)*\.[xX]$').match
            match = rex(branch)
            if not match:
                make.fail("Not in master or release branch.")

        lines = shell.spawn(
            git, 'status', '--porcelain',
            stdout=True, env=dict(_os.environ, LC_ALL='C'),
        )
        if lines:
            make.fail("Uncommitted changes!")
コード例 #2
0
 def _update_versions(self):
     """ Update versions """
     self.runner('revision', 'version', seen={})
     git = shell.frompath('git')
     shell.spawn(git, 'commit', '-a', '-m', 'Pre-release: version update',
         echo=True
     )
コード例 #3
0
    def _tag_release(self):
        """ Tag release """
        from _setup.util import SafeConfigParser as parser
        parser = parser()
        parser.read('package.cfg', **cfgread)
        strversion = parser.get('package', 'version.number')
        version = strversion
        trunk_url = self._repo_url()
        if not trunk_url.endswith('/trunk'):
            rex = _re.compile(r'/branches/\d+(?:\.\d+)*\.[xX]$').search
            match = rex(trunk_url)
            if not match:
                make.fail("Not in trunk or release branch!")
            found = match.start(0)
        else:
            found = -len('/trunk')
        release_url = trunk_url[:found] + '/releases/' + version

        svn = shell.frompath('svn')
        shell.spawn(
            svn,
            'copy',
            '-m',
            'Release version ' + version,
            '--',
            trunk_url,
            release_url,
            echo=True,
        )
コード例 #4
0
    def _check_committed(self):
        """ Check if everything is committed """
        git = shell.frompath('git')
        lines = shell.spawn(git,
                            'branch',
                            '--color=never',
                            stdout=True,
                            env=dict(_os.environ, LC_ALL='C')).splitlines()
        for line in lines:
            if line.startswith('*'):
                branch = line.split(None, 1)[1]
                break
        else:
            make.fail("Could not determine current branch.")
        if branch != 'master':
            rex = _re.compile(r'^\d+(?:\.\d+)*\.[xX]$').match
            match = rex(branch)
            if not match:
                make.fail("Not in master or release branch.")

        lines = shell.spawn(
            git,
            'status',
            '--porcelain',
            stdout=True,
            env=dict(_os.environ, LC_ALL='C'),
        )
        if lines:
            make.fail("Uncommitted changes!")
コード例 #5
0
ファイル: make.py プロジェクト: ndparker/wtf
    def _tag_release(self):
        """ Tag release """
        from _setup.util import SafeConfigParser as parser
        parser = parser()
        parser.read('package.cfg', **cfgread)
        strversion = parser.get('package', 'version.number')
        isdev = parser.getboolean('package', 'version.dev')
        revision = parser.getint('package', 'version.revision')
        version = strversion
        if isdev:
            version += '-dev-r%d' % (revision,)
        trunk_url = self._repo_url()
        if not trunk_url.endswith('/trunk'):
            rex = _re.compile(r'/branches/\d+(?:\.\d+)*\.[xX]$').search
            match = rex(trunk_url)
            if not match:
                make.fail("Not in trunk or release branch!")
            found = match.start(0)
        else:
            found = -len('/trunk')
        release_url = trunk_url[:found] + '/releases/' + version

        svn = shell.frompath('svn')
        shell.spawn(
            svn, 'copy', '-m', 'Release version ' + version, '--',
            trunk_url, release_url,
            echo=True,
        )
コード例 #6
0
ファイル: targets.py プロジェクト: ndparker/setup-common
 def sign_external(self, filename, detach=True):
     """ Sign calling gpg """
     gpg = _shell.frompath('gpg')
     if gpg is None:
         _make.warn('GPG not found -> cannot sign')
         return False
     if detach:
         _shell.spawn(
             gpg,
             '--armor',
             '--output',
             filename + '.asc',
             '--detach-sign',
             '--',
             filename,
         )
     else:
         _shell.spawn(
             gpg,
             '--output',
             filename + '.signed',
             '--clearsign',
             '--',
             filename,
         )
         _os.rename(filename + '.signed', filename)
     return True
コード例 #7
0
ファイル: make.py プロジェクト: ndparker/tdi
    def _tag_release(self):
        """ Tag release """
        from _setup.util import SafeConfigParser as parser

        parser = parser()
        parser.read("package.cfg", **cfgread)
        strversion = parser.get("package", "version.number")
        isdev = parser.getboolean("package", "version.dev")
        revision = parser.getint("package", "version.revision")
        version = strversion
        if isdev:
            version += "-dev-r%d" % (revision,)
        trunk_url = self._repo_url()
        if not trunk_url.endswith("/trunk"):
            rex = _re.compile(r"/branches/\d+(?:\.\d+)*\.[xX]$").search
            match = rex(trunk_url)
            if not match:
                make.fail("Not in trunk or release branch!")
            found = match.start(0)
        else:
            found = -len("/trunk")
        release_url = trunk_url[:found] + "/releases/" + version

        svn = shell.frompath("svn")
        shell.spawn(svn, "copy", "-m", "Release version " + version, "--", trunk_url, release_url, echo=True)
コード例 #8
0
ファイル: make.py プロジェクト: ndparker/wtf
 def _update_versions(self):
     """ Update versions """
     self.runner('revision', 'version', seen={})
     git = shell.frompath('git')
     shell.spawn(git, 'commit', '-a', '-m', 'Pre-release: version update',
         echo=True
     )
コード例 #9
0
ファイル: make.py プロジェクト: hkmshb/rjsmin
 def _update_versions(self):
     """ Update versions """
     self.runner('version', seen={})
     svn = shell.frompath('svn')
     shell.spawn(svn, 'commit', '-m', 'Pre-release: version update',
         echo=True
     )
コード例 #10
0
ファイル: make.py プロジェクト: ndparker/tdi
 def dist_pkg(self):
     term.green("Building package...")
     dist.run_setup("sdist", "--formats", "tar,zip", fakeroot=shell.frompath("fakeroot"))
     exts = [".zip"]
     for name in shell.files(self.dirs["dist"], "*.tar", False):
         exts.extend(self.compress(name))
         shell.rm(name)
     return exts
コード例 #11
0
ファイル: targets.py プロジェクト: empyrical/rcssmin
 def compress_external(self, infile, outfile, *argv):
     argv = list(argv)
     argv[0] = _shell.frompath(argv[0])
     if argv[0] is not None:
         return not _shell.spawn(*argv, **{
             'filepipe': True, 'stdin': infile, 'stdout': outfile,
         })
     return None
コード例 #12
0
 def _update_versions(self):
     """ Update versions """
     self.runner('version', seen={})
     svn = shell.frompath('svn')
     shell.spawn(svn,
                 'commit',
                 '-m',
                 'Pre-release: version update',
                 echo=True)
コード例 #13
0
ファイル: targets.py プロジェクト: empyrical/rcssmin
 def dist_pkg(self):
     _term.green("Building package...")
     _dist.run_setup("sdist", "--formats", "tar,zip",
         fakeroot=_shell.frompath('fakeroot')
     )
     exts = ['.zip']
     for name in _shell.files(self._dist, '*.tar', False):
         exts.extend(self.compress(name))
         _shell.rm(name)
     return exts
コード例 #14
0
 def run(self):
     files = list(shell.files(self.dirs['bench'], '*.css'))
     if self.python is None:
         python = _sys.executable
     else:
         python = shell.frompath(self.python)
     return not shell.spawn(*[
         python,
         '-mbench.main',
         '-c10',
     ] + files)
コード例 #15
0
ファイル: targets.py プロジェクト: ndparker/setup-common
 def compress_external(self, infile, outfile, *argv):
     argv = list(argv)
     argv[0] = _shell.frompath(argv[0])
     if argv[0] is not None:
         return not _shell.spawn(
             *argv, **{
                 'filepipe': True,
                 'stdin': infile,
                 'stdout': outfile,
             })
     return None
コード例 #16
0
ファイル: targets.py プロジェクト: ndparker/setup-common
 def dist_pkg(self):
     _term.green("Building package...")
     _dist.run_setup("sdist",
                     "--formats",
                     "tar,zip",
                     fakeroot=_shell.frompath('fakeroot'))
     exts = ['.zip']
     for name in _shell.files(self._dist, '*.tar', False):
         exts.extend(self.compress(name))
         _shell.rm(name)
     return exts
コード例 #17
0
ファイル: make.py プロジェクト: hkmshb/rjsmin
 def run(self):
     files = list(shell.files(self.dirs['bench'], '*.js'))
     if self.python is None:
         python = _sys.executable
     else:
         python = shell.frompath(self.python)
     return not shell.spawn(*[
         python,
         '-mbench.main',
         '-c10',
     ] + files)
コード例 #18
0
ファイル: make.py プロジェクト: ndparker/tdi
 def sign_external(self, filename, detach=True):
     """ Sign calling gpg """
     gpg = shell.frompath("gpg")
     if gpg is None:
         make.warn("GPG not found -> cannot sign")
         return False
     if detach:
         shell.spawn(gpg, "--armor", "--output", filename + ".asc", "--detach-sign", "--", filename)
     else:
         shell.spawn(gpg, "--output", filename + ".signed", "--clearsign", "--", filename)
         _os.rename(filename + ".signed", filename)
     return True
コード例 #19
0
ファイル: make.py プロジェクト: hkmshb/rjsmin
 def _tag_release(self):
     """ Tag release """
     from _setup.util import SafeConfigParser as parser
     parser = parser()
     parser.read('package.cfg', **cfgread)
     strversion = parser.get('package', 'version.number')
     version = strversion
     git = shell.frompath('git')
     shell.spawn(
         git, 'tag', '-a', '-m', 'Release version ' + version, '--',
         version,
         echo=True,
     )
コード例 #20
0
ファイル: make.py プロジェクト: ndparker/tdi
    def _tag_release(self):
        """ Tag release """
        from _setup.util import SafeConfigParser as parser

        parser = parser()
        parser.read("package.cfg", **cfgread)
        strversion = parser.get("package", "version.number")
        isdev = parser.getboolean("package", "version.dev")
        revision = parser.getint("package", "version.revision")
        version = strversion
        if isdev:
            version += "-dev-r%d" % (revision,)
        git = shell.frompath("git")
        shell.spawn(git, "tag", "-a", "-m", "Release version " + version, "--", version, echo=True)
コード例 #21
0
 def _revision(self):
     """ Find SVN revision """
     rev = shell.spawn(shell.frompath('svnversion'), '.', stdout=True)
     rev = rev.strip()
     if ':' in rev:
         rev = rev.split(':')[1]
     try:
         rev = int(rev)
     except ValueError:
         try:
             rev = int(rev[:-1])
         except ValueError:
             make.fail("No clean revision found (%s)" % rev)
     return rev
コード例 #22
0
ファイル: make.py プロジェクト: ndparker/wtf
 def _revision(self):
     """ Find SVN revision """
     rev = shell.spawn(shell.frompath('svnversion'), '.', stdout=True)
     rev = rev.strip()
     if ':' in rev:
         rev = rev.split(':')[1]
     try:
         rev = int(rev)
     except ValueError:
         try:
             rev = int(rev[:-1])
         except ValueError:
             make.fail("No clean revision found (%s)" % rev)
     return rev
コード例 #23
0
ファイル: make.py プロジェクト: ndparker/wtf
 def _check_committed(self):
     """ Check if everything is committed """
     if not self._repo_url().endswith('/trunk'):
         rex = _re.compile(r'/branches/\d+(?:\.\d+)*\.[xX]$').search
         match = rex(self._repo_url())
         if not match:
             make.fail("Not in trunk or release branch!")
     svn = shell.frompath('svn')
     lines = shell.spawn(svn, 'stat', '--ignore-externals',
         stdout=True, env=dict(_os.environ, LC_ALL='C'),
     ).splitlines()
     for line in lines:
         if line.startswith('X'):
             continue
         make.fail("Uncommitted changes!")
コード例 #24
0
 def _repo_url(self):
     """ Determine URL """
     from xml.dom import minidom
     svn = shell.frompath('svn')
     info = minidom.parseString(
         shell.spawn(svn, 'info', '--xml', stdout=True))
     try:
         url = info.getElementsByTagName('url')[0]
         text = []
         for node in url.childNodes:
             if node.nodeType == node.TEXT_NODE:
                 text.append(node.data)
     finally:
         info.unlink()
     return ''.join(text).encode('utf-8')
コード例 #25
0
 def _check_committed(self):
     """ Check if everything is committed """
     if not self._repo_url().endswith('/trunk'):
         rex = _re.compile(r'/branches/\d+(?:\.\d+)*\.[xX]$').search
         match = rex(self._repo_url())
         if not match:
             make.fail("Not in trunk or release branch!")
     svn = shell.frompath('svn')
     lines = shell.spawn(svn, 'stat', '--ignore-externals',
         stdout=True, env=dict(_os.environ, LC_ALL='C'),
     ).splitlines()
     for line in lines:
         if line.startswith('X'):
             continue
         make.fail("Uncommitted changes!")
コード例 #26
0
ファイル: make.py プロジェクト: ndparker/tdi
    def _repo_url(self):
        """ Determine URL """
        from xml.dom import minidom

        svn = shell.frompath("svn")
        info = minidom.parseString(shell.spawn(svn, "info", "--xml", stdout=True))
        try:
            url = info.getElementsByTagName("url")[0]
            text = []
            for node in url.childNodes:
                if node.nodeType == node.TEXT_NODE:
                    text.append(node.data)
        finally:
            info.unlink()
        return ("".decode("ascii")).join(text).encode("utf-8")
コード例 #27
0
ファイル: make.py プロジェクト: ndparker/wtf
 def _repo_url(self):
     """ Determine URL """
     from xml.dom import minidom
     svn = shell.frompath('svn')
     info = minidom.parseString(
         shell.spawn(svn, 'info', '--xml', stdout=True)
     )
     try:
         url = info.getElementsByTagName('url')[0]
         text = []
         for node in url.childNodes:
             if node.nodeType == node.TEXT_NODE:
                 text.append(node.data)
     finally:
         info.unlink()
     return ''.join(text).encode('utf-8')
コード例 #28
0
ファイル: make.py プロジェクト: ndparker/wtf
 def _tag_release(self):
     """ Tag release """
     from _setup.util import SafeConfigParser as parser
     parser = parser()
     parser.read('package.cfg', **cfgread)
     strversion = parser.get('package', 'version.number')
     isdev = parser.getboolean('package', 'version.dev')
     revision = parser.getint('package', 'version.revision')
     version = strversion
     if isdev:
         version += '-dev-r%d' % (revision,)
     git = shell.frompath('git')
     shell.spawn(
         git, 'tag', '-a', '-m', 'Release version ' + version, '--',
         version,
         echo=True,
     )
コード例 #29
0
 def _tag_release(self):
     """ Tag release """
     from _setup.util import SafeConfigParser as parser
     parser = parser()
     parser.read('package.cfg', **cfgread)
     strversion = parser.get('package', 'version.number')
     isdev = parser.getboolean('package', 'version.dev')
     revision = parser.getint('package', 'version.revision')
     version = strversion
     if isdev:
         version += '.dev%d' % (revision,)
     git = shell.frompath('git')
     shell.spawn(
         git, 'tag', '-a', '-m', 'Release version ' + version, '--',
         version,
         echo=True,
     )
コード例 #30
0
ファイル: userdoc.py プロジェクト: AvdN/tdi
def sphinx(**kwargs):
    """ Run sphinx """
    prog = _shell.frompath('sphinx-build')
    if prog is None:
        _term.red("sphinx-build not found")
        return False

    env = dict(_os.environ)

    argv = [
        prog, '-a',
        '-d', _os.path.join(kwargs['build'], 'doctrees'),
        '-b', 'html',
        kwargs['source'],
        kwargs['target'],
    ]

    return not _shell.spawn(*argv, **{'env': env})
コード例 #31
0
def sphinx(**kwargs):
    """ Run sphinx """
    prog = _shell.frompath('sphinx-build')
    if prog is None:
        _term.red("sphinx-build not found")
        return False

    env = dict(_os.environ)

    argv = [
        prog, '-a',
        '-d', _os.path.join(kwargs['build'], 'doctrees'),
        '-b', 'html',
        kwargs['source'],
        kwargs['target'],
    ]

    return not _shell.spawn(*argv, **{'env': env})
コード例 #32
0
 def _tag_release(self):
     """ Tag release """
     from _setup.util import SafeConfigParser as parser
     parser = parser()
     parser.read('package.cfg', **cfgread)
     strversion = parser.get('package', 'version.number')
     version = strversion
     git = shell.frompath('git')
     shell.spawn(
         git,
         'tag',
         '-a',
         '-m',
         'Release version ' + version,
         '--',
         version,
         echo=True,
     )
コード例 #33
0
ファイル: make.py プロジェクト: ndparker/tdi
    def _check_committed(self):
        """ Check if everything is committed """
        git = shell.frompath("git")
        lines = shell.spawn(git, "branch", "--color=never", stdout=True, env=dict(_os.environ, LC_ALL="C")).splitlines()
        for line in lines:
            if line.startswith("*"):
                branch = line.split(None, 1)[1]
                break
        else:
            make.fail("Could not determine current branch.")
        if branch != "master":
            rex = _re.compile(r"^\d+(?:\.\d+)*\.[xX]$").match
            match = rex(branch)
            if not match:
                make.fail("Not in master or release branch.")

        lines = shell.spawn(git, "status", "--porcelain", stdout=True, env=dict(_os.environ, LC_ALL="C"))
        if lines:
            make.fail("Uncommitted changes!")
コード例 #34
0
ファイル: userdoc.py プロジェクト: ndparker/setup-common
def sphinx(**kwargs):
    """ Run sphinx """
    prog = _shell.frompath("sphinx-build")
    if prog is None:
        _term.red("sphinx-build not found")
        return False

    env = dict(_os.environ)

    argv = [
        prog,
        "-a",
        "-d",
        _os.path.join(kwargs["build"], "doctrees"),
        "-b",
        "html",
        kwargs["source"],
        kwargs["target"],
    ]

    return not _shell.spawn(*argv, **{"env": env})
コード例 #35
0
ファイル: targets.py プロジェクト: empyrical/rcssmin
 def sign_external(self, filename, detach=True):
     """ Sign calling gpg """
     gpg = _shell.frompath('gpg')
     if gpg is None:
         _make.warn('GPG not found -> cannot sign')
         return False
     if detach:
         _shell.spawn(gpg,
             '--armor',
             '--output', filename + '.asc',
             '--detach-sign',
             '--',
             filename,
         )
     else:
         _shell.spawn(gpg,
             '--output', filename + '.signed',
             '--clearsign',
             '--',
             filename,
         )
         _os.rename(filename + '.signed', filename)
     return True
コード例 #36
0
ファイル: make.py プロジェクト: ndparker/tdi
 def compress_external(self, infile, outfile, *argv):
     argv = list(argv)
     argv[0] = shell.frompath(argv[0])
     if argv[0] is not None:
         return not shell.spawn(*argv, **{"filepipe": True, "stdin": infile, "stdout": outfile})
     return None
コード例 #37
0
ファイル: make.py プロジェクト: ndparker/tdi
 def _update_versions(self):
     """ Update versions """
     self.runner("revision", "version", seen={})
     git = shell.frompath("git")
     shell.spawn(git, "commit", "-a", "-m", "Pre-release: version update", echo=True)
コード例 #38
0
ファイル: apidoc.py プロジェクト: ndparker/setup-common
def epydoc(**kwargs):
    """ Run epydoc """
    # pylint: disable = R0912
    prog = kwargs.get('epydoc') or 'epydoc'
    if not _os.path.dirname(_os.path.normpath(prog)):
        prog = _shell.frompath(prog)
    if not prog:
        _term.red("%(epydoc)s not found",
            epydoc=kwargs.get('epydoc') or 'epydoc',
        )
        return False

    version = _VERSION_SEARCH(_shell.spawn(prog, "--version", stdout=True))
    if version is not None:
        try:
            version = tuple(map(int, version.group('major', 'minor')))
        except (TypeError, ValueError):
            version = None
    if version is None:
        _term.red("%(prog)s version not recognized" % locals())
        return False

    if version < (3, 0):
        _term.red("%(prog)s is too old %(version)r < (3, 0)" % locals())
        return False

    env = dict(_os.environ)

    prepend = kwargs.get('prepend')
    if prepend:
        toprepend = _os.pathsep.join(map(str, prepend))
        if 'PYTHONPATH' in env:
            env['PYTHONPATH'] = _os.pathsep.join((
                toprepend, env['PYTHONPATH']
            ))
        else:
            env['PYTHONPATH'] = toprepend

    append = kwargs.get('append')
    if append:
        toappend = _os.pathsep.join(map(str, append))
        if 'PYTHONPATH' in env:
            env['PYTHONPATH'] = _os.pathsep.join((
                env['PYTHONPATH'], toappend
            ))
        else:
            env['PYTHONPATH'] = toappend

    moreenv = kwargs.get('env')
    if moreenv:
        env.update(moreenv)

    config = kwargs.get('config') or _shell.native('docs/epydoc.conf')

    argv = [prog, '--config', config]
    res = not _shell.spawn(*argv, **{'env': env})
    if res:
        cfg = _util.SafeConfigParser()
        cfg.read(config)
        try:
            target = dict(cfg.items('epydoc'))['target']
        except KeyError:
            pass
        else:
            _cleanup_epydoc(target)
    return res
コード例 #39
0
ファイル: apidoc.py プロジェクト: AvdN/tdi
def epydoc(**kwargs):
    """ Run epydoc """
    # pylint: disable = R0912
    prog = kwargs.get('epydoc') or 'epydoc'
    if not _os.path.dirname(_os.path.normpath(prog)):
        prog = _shell.frompath(prog)
    if not prog:
        _term.red("%(epydoc)s not found",
            epydoc=kwargs.get('epydoc') or 'epydoc',
        )
        return False

    version = _VERSION_SEARCH(_shell.spawn(prog, "--version", stdout=True))
    if version is not None:
        try:
            version = tuple(map(int, version.group('major', 'minor')))
        except (TypeError, ValueError):
            version = None
    if version is None:
        _term.red("%(prog)s version not recognized" % locals())
        return False

    if version < (3, 0):
        _term.red("%(prog)s is too old %(version)r < (3, 0)" % locals())
        return False

    env = dict(_os.environ)

    prepend = kwargs.get('prepend')
    if prepend:
        toprepend = _os.pathsep.join(map(str, prepend))
        if 'PYTHONPATH' in env:
            env['PYTHONPATH'] = _os.pathsep.join((
                toprepend, env['PYTHONPATH']
            ))
        else:
            env['PYTHONPATH'] = toprepend

    append = kwargs.get('append')
    if append:
        toappend = _os.pathsep.join(map(str, append))
        if 'PYTHONPATH' in env:
            env['PYTHONPATH'] = _os.pathsep.join((
                env['PYTHONPATH'], toappend
            ))
        else:
            env['PYTHONPATH'] = toappend

    moreenv = kwargs.get('env')
    if moreenv:
        env.update(moreenv)

    config = kwargs.get('config') or _shell.native('docs/epydoc.conf')

    argv = [prog, '--config', config]
    res = not _shell.spawn(*argv, **{'env': env})
    if res:
        cfg = _util.SafeConfigParser()
        cfg.read(config)
        try:
            target = dict(cfg.items('epydoc'))['target']
        except KeyError:
            pass
        else:
            _cleanup_epydoc(target)
    return res