コード例 #1
0
ファイル: baserelease.py プロジェクト: Vinsurya/Plone
 def __init__(self):
     self.vcs = choose.version_control()
     self.data = {'workingdir': self.vcs.workingdir,
                  'name': self.vcs.name}
     self.setup_cfg = pypi.SetupConfig()
     if self.setup_cfg.no_input():
         utils.AUTO_RESPONSE = True
コード例 #2
0
 def __init__(self, vcs=None):
     os.environ["ZESTRELEASER"] = "We are called from within zest.releaser"
     # ^^^ Env variable so called tools can detect us. Don't depend on the
     # actual text, just on the variable's name.
     if vcs is None:
         self.vcs = choose.version_control()
     else:
         # In a fullrelease, we share the determined vcs between
         # prerelease, release and postrelease.
         self.vcs = vcs
     self.data = {
         'name': self.vcs.name,
         'nothing_changed_yet': NOTHING_CHANGED_YET,
         'reporoot': self.vcs.reporoot,
         'workingdir': self.vcs.workingdir,
     }
     self.setup_cfg = pypi.SetupConfig()
     if utils.TESTMODE:
         pypirc_old = pkg_resources.resource_filename(
             'zest.releaser.tests', 'pypirc_old.txt')
         self.pypiconfig = pypi.PypiConfig(pypirc_old)
     else:
         self.pypiconfig = pypi.PypiConfig()
     if self.pypiconfig.no_input():
         utils.AUTO_RESPONSE = True
コード例 #3
0
ファイル: script.py プロジェクト: mpeeters/check.changelog
def main():
    vcs = choose.version_control()
    changelogs = Changelogs(vcs)
    last_tag = utils.get_last_tag(vcs)
    git_command = vcs.cmd_log_since_tag(last_tag)
    changes = GitChanges(utils.system(git_command))
    print 'There are {0} commit(s) for {1} line(s) in changelog'.format(
        len(changes.commits),
        len(changelogs.last_version.logs),
    )
コード例 #4
0
ファイル: baserelease.py プロジェクト: blampe/zest.releaser
 def __init__(self):
     self.vcs = choose.version_control()
     self.data = {'workingdir': self.vcs.workingdir,
                  'name': self.vcs.name}
     self.setup_cfg = pypi.SetupConfig()
     if self.setup_cfg.no_input():
         utils.AUTO_RESPONSE = True
     if utils.TESTMODE:
         pypirc_old = pkg_resources.resource_filename(
             'zest.releaser.tests', 'pypirc_old.txt')
         self.pypiconfig = pypi.PypiConfig(pypirc_old)
     else:
         self.pypiconfig = pypi.PypiConfig()
コード例 #5
0
 def __init__(self, vcs=None):
     if vcs is None:
         self.vcs = choose.version_control()
     else:
         # In a fullrelease, we share the determined vcs between
         # prerelease, release and postrelease.
         self.vcs = vcs
     self.data = {'workingdir': self.vcs.workingdir,
                  'reporoot': self.vcs.reporoot,
                  'name': self.vcs.name}
     self.setup_cfg = pypi.SetupConfig()
     if utils.TESTMODE:
         pypirc_old = pkg_resources.resource_filename(
             'zest.releaser.tests', 'pypirc_old.txt')
         self.pypiconfig = pypi.PypiConfig(pypirc_old)
     else:
         self.pypiconfig = pypi.PypiConfig()
     if self.pypiconfig.no_input():
         utils.AUTO_RESPONSE = True
コード例 #6
0
def prepare_vcs(vcs):
    """ Set vcs on self before running __init__, i.e.:

        >>> def __init__(self, vcs=None):
        >>>     vcs = utils.prepare_vcs(vcs)
        >>>     super().__init__()

        This will deal with the vcs being set on baserelease, while we want
        to set it our own way, recognising gitflow.
    """

    # baserelease sets vcs on __init__ if vcs == None
    if vcs is None:
        # In our preparation, we do the same check in order to have vcs
        # defined when calling the super().__init__()
        return enhance_with_gitflow(version_control())
    # If vcs was set already, we're golden and we can return the previously
    # set value.
    return vcs
コード例 #7
0
 def __init__(self, vcs=None):
     if vcs is None:
         self.vcs = choose.version_control()
     else:
         # In a fullrelease, we share the determined vcs between
         # prerelease, release and postrelease.
         self.vcs = vcs
     self.data = {'workingdir': self.vcs.workingdir,
                  'reporoot': self.vcs.reporoot,
                  'name': self.vcs.name}
     self.setup_cfg = pypi.SetupConfig()
     if self.setup_cfg.no_input():
         utils.AUTO_RESPONSE = True
     if utils.TESTMODE:
         pypirc_old = pkg_resources.resource_filename(
             'zest.releaser.tests', 'pypirc_old.txt')
         self.pypiconfig = pypi.PypiConfig(pypirc_old)
     else:
         self.pypiconfig = pypi.PypiConfig()
コード例 #8
0
ファイル: utils.py プロジェクト: virtualsciences/egg.releaser
def prepare_vcs(vcs):
    """ Set vcs on self before running __init__, i.e.:

        >>> def __init__(self, vcs=None):
        >>>     vcs = utils.prepare_vcs(vcs)
        >>>     super().__init__()

        This will deal with the vcs being set on baserelease, while we want
        to set it our own way, recognising gitflow.
    """

    # baserelease sets vcs on __init__ if vcs == None
    if vcs is None:
        # In our preparation, we do the same check in order to have vcs
        # defined when calling the super().__init__()
        return enhance_with_gitflow(version_control())
    # If vcs was set already, we're golden and we can return the previously
    # set value.
    return vcs
コード例 #9
0
ファイル: utils.py プロジェクト: IMIO/i18ndude
def prepare_cli_documentation(data):
    """Update the command line docs in the docs dir.

    This uses a hook from zest.releaser to update some documentation
    when doing a release.  See our setup.py and setup.cfg.
    """
    if data['name'] != 'i18ndude':
        # We're available everywhere, but we're only intended to be
        # used when we release i18ndude.
        return
    target = os.path.join(data['workingdir'], 'docs',
                          'command.rst')
    marker = '.. ### AUTOGENERATED FROM HERE ###'
    result = []
    for line in open(target).readlines():
        line = line.rstrip()
        if line == marker:
            break
        result.append(line)
    result.append(marker)
    result.append('')

    def indent(text):
        result = []
        for line in text.splitlines():
            if line:
                result.append('  ' + line)
            else:
                result.append('')
        return result

    base_cmd = 'bin/i18ndude'
    # Add result off calling bin/i18ndude --help
    result.append('i18ndude')
    result.append('--------')
    result.append("\n::\n")
    res = subprocess.check_output([base_cmd, '--help'])
    result.extend(indent(res))
    # Same for the subcommands.
    subcommands = [
        'find-untranslated',
        'rebuild-pot',
        'merge',
        'sync',
        'filter',
        'admix',
        'list',
        'trmerge']
    for sub in subcommands:
        result.append('')
        result.append(sub)
        result.append('-' * len(sub))
        result.append("\n::\n")
        res = subprocess.check_output([base_cmd, sub, '--help'])
        result.extend(indent(res))

    result.append('')
    open(target, 'wb').write('\n'.join(result))
    print "Wrote command line documentation to", target

    # If there is a diff, we want to commit it.
    from zest.releaser import choose
    from zest.releaser.utils import ask, execute_command
    vcs = choose.version_control()
    diff_cmd = vcs.cmd_diff()
    diff = execute_command(diff_cmd)
    if diff.strip():
        print "The %r:\n\n%s\n" % (diff_cmd, diff)
        if ask("OK to commit this"):
            msg = "Wrote command line documentation."
            commit_cmd = vcs.cmd_commit(msg)
            print execute_command(commit_cmd)
コード例 #10
0
ファイル: _release.py プロジェクト: Python3pkg/PyFITS
 def __init__(self):
     self.vcs = version_control()
     self.history_lines = []
     self.previous_version = ''
     self.released_version = ''
コード例 #11
0
ファイル: _release.py プロジェクト: pombredanne/PyFITS
 def __init__(self):
     self.vcs = version_control()
     self.history_lines = []
     self.previous_version = ""
     self.released_version = ""
コード例 #12
0
ファイル: config.py プロジェクト: nens/sitesetup
    def get_default(self, key):
        """Someone asked why this is done with a list of IFs.

        The obvious alternative is to make this a dictionary, but that
        doesn't quite work: many values are not constant. Recreating the whole
        dictionary each time to only return a single one of its values isn't
        the solution.

        It could be replaced by a dictionary of which the values are
        functions (either lambdas or normal functions) but that leads to more
        code.

        Anyway, the function belong is long but perfectly readable.
        """

        if key == 'deployment_type':
            return self.deployment_type

        if key == 'basedir':
            return '/srv/%s' % self.get('domainname')

        if key == 'buildout-file':
            return '%s.cfg' % self.deployment_type

        if key == 'databases':
            return self.get_from_django('DATABASES')

        if key == 'djangosettings':
            return "%s.%s" % (self.get('project'),
                              self.get('djangosettingsfile'))

        if key == 'djangosettingsfile':
            return self.get_from_buildout('django', 'settings')

        if key == 'domainname':
            return self.get_from_buildout('serverconfig', 'sitename')

        if key == 'git':
            return self.get('vcs').internal_filename == '.git'

        if key == 'tag':
            return get_last_tag(self.get('vcs'))

        if key == 'project':
            return self.get_from_buildout('django', 'project')

        if key == 'svn':
            return not self.get('git')

        if key == 'vcs':
            return choose.version_control()

        if key == 'var_dirs':
            return ('media',)

        if key == 'checkout':
            return 'tag'

        if key == 'web_host':
            if self.deployment_type == 'development':
                return 'localhost'

        return None
コード例 #13
0
ファイル: utils.py プロジェクト: collective/i18ndude
def prepare_cli_documentation(data):
    """Update the command line docs in the docs dir.

    This uses a hook from zest.releaser to update some documentation
    when doing a release.  See our setup.py and setup.cfg.
    """
    if data['name'] != 'i18ndude':
        # We're available everywhere, but we're only intended to be
        # used when we release i18ndude.
        return
    target = os.path.join(data['workingdir'], 'docs', 'command.rst')
    marker = '.. ### AUTOGENERATED FROM HERE ###'
    result = []
    for line in open(target).readlines():
        line = line.rstrip()
        if line == marker:
            break
        result.append(line)
    result.append(marker)
    result.append('')

    def indent(text):
        result = []
        for line in text.splitlines():
            if line:
                result.append('  ' + line)
            else:
                result.append('')
        return result

    base_cmd = 'bin/i18ndude'
    # Add result off calling bin/i18ndude --help
    result.append('i18ndude')
    result.append('--------')
    result.append("\n::\n")
    res = subprocess.check_output([base_cmd, '--help'])
    result.extend(indent(res))
    # Same for the subcommands.
    subcommands = [
        'find-untranslated', 'rebuild-pot', 'merge', 'sync', 'filter', 'admix',
        'list', 'trmerge'
    ]
    for sub in subcommands:
        result.append('')
        result.append(sub)
        result.append('-' * len(sub))
        result.append("\n::\n")
        res = subprocess.check_output([base_cmd, sub, '--help'])
        result.extend(indent(res))

    result.append('')
    open(target, 'w').write('\n'.join(result))
    print("Wrote command line documentation to", target)

    # If there is a diff, we want to commit it.
    from zest.releaser import choose
    from zest.releaser.utils import ask, execute_command
    vcs = choose.version_control()
    diff_cmd = vcs.cmd_diff()
    diff = execute_command(diff_cmd)
    if diff.strip():
        print("The %r:\n\n%s\n" % (diff_cmd, diff))
        if ask("OK to commit this"):
            msg = "Wrote command line documentation."
            commit_cmd = vcs.cmd_commit(msg)
            print(execute_command(commit_cmd))
コード例 #14
0
 def __init__(self):
     self.vcs = choose.version_control()
     self.data = {'workingdir': self.vcs.workingdir, 'name': self.vcs.name}
     self.setup_cfg = pypi.SetupConfig()
     if self.setup_cfg.no_input():
         utils.AUTO_RESPONSE = True
コード例 #15
0
 def __init__(self):
     self.vcs = choose.version_control()
     self.data = {'workingdir': self.vcs.workingdir,
                  'name': self.vcs.name}