Permalink
Browse files

Merge pull request #5 from mapleoin/travis

Awesome
  • Loading branch information...
2 parents 1bb3d78 + c44c25b commit 04bfb483f1339f9632c1d10f12127b5682c5bf8f @saschpe saschpe committed Jan 17, 2013
Showing with 39 additions and 17 deletions.
  1. +10 −0 .travis.yml
  2. +4 −6 README.rst
  3. +21 −11 git_tarballs
  4. +1 −0 pip-requires
  5. +3 −0 test-requires
View
@@ -0,0 +1,10 @@
+language: python
+python:
+ - "2.6"
+ - "2.7"
+install:
+ - pip install -r pip-requires --use-mirrors
+ - pip install -r test-requires --use-mirrors
+script:
+ - nosetests
+ - pep8 git_tarballs *py
View
@@ -22,13 +22,11 @@ On the first run, ``git_tarballs`` will just set the spec file's
be updated with commit message information when newer commits (compared
to the one now set in ``Version``) are found.
-Dependencies
-------------
+Up to date requirements are kept in the files ``pip-requires`` and
+``test-requires``
-Requires argparse which is part of python2.7, but available as a
-third-party dependency in python2.6.
-
-The tests require `python-mock`_. To run them, just use ``nosetests`` or ``python -m unittest discover`` (on python2.7).
+To run the testsuite, just use ``nosetests`` or ``python -m unittest
+discover`` (on python2.7).
TODO
View
@@ -70,12 +70,14 @@ def get_parent_dir_and_version_from_tarball(tar_name, version_regexp):
"version in '%s': no match" % (version_regexp, parent_dir))
elif len(match.groups()) != 1:
sys.exit("Could not use '%s' as regular expression to find "
- "version in '%s': more than one match" % (version_regexp, parent_dir))
+ "version in '%s': more than one match" %
+ (version_regexp, parent_dir))
else:
version = match.group(1)
return (parent_dir, version)
+
def get_upstream_commit(changelog):
try:
return re.search(r'^commit (.*?)$', changelog, re.MULTILINE).group(1)
@@ -151,9 +153,10 @@ def update_spec_file(package_version, tarball_parent_dir, filename):
def diff_changes(changes_list, package_commit):
"""Return a list of dict changes newer than the ones in package_version
-
+
:changes_list: a list of dicts from the ChangeLog file
- :package_commit: a git commit hash of the current version from the spec file
+ :package_commit: a git commit hash of the current version from the
+ spec file
Returns an empty list if there are no newer commits.
@@ -173,7 +176,8 @@ def create_changes(changes_list, package_version, package_commit, email):
:changes_list: a list of dicts from the ChangeLog file
:package_version: release version string for the .changes file entry
- :package_commit: a git commit hash of the current version from the spec file
+ :package_commit: a git commit hash of the current version from the
+ spec file
:email: email address used for the .changes file entry
"""
@@ -188,8 +192,8 @@ def create_changes(changes_list, package_version, package_commit, email):
commits = " + " + "\n + ".join(c['message'] for c in changes_diff
if not c['message'].startswith('Merge "'))
change = (
- '--------------------------------------------------------------------\n'
- '%(timestamp)s - %(email)s\n'
+ '--------------------------------------------------------------------'
+ '\n%(timestamp)s - %(email)s\n'
'\n'
'- Update to version %(package_version)s:\n'
'%(commits)s\n'
@@ -199,7 +203,7 @@ def create_changes(changes_list, package_version, package_commit, email):
def update_changes_file(package, changes):
- try:
+ try:
f = open(package + '.changes', 'r+')
contents = f.read()
f.seek(0)
@@ -218,10 +222,14 @@ if __name__ == '__main__':
parser.add_argument('--package',
help='the OBS package name')
parser.add_argument('--email', required=True,
- help='email of the commit author (for the .changes file)')
+ help='email of the commit author '
+ '(for the .changes file)')
parser.add_argument('--version-regexp', default='.*-([^-]+)',
- help='regular expression for extracting version from top-level directory in tarball (default: ".*-([^-]+)")')
- parser.add_argument('--outdir', help='osc service parameter that does nothing')
+ help='regular expression for extracting version from '
+ 'top-level directory in tarball '
+ '(default: ".*-([^-]+)")')
+ parser.add_argument('--outdir',
+ help='osc service parameter that does nothing')
args = parser.parse_args()
if not args.filename:
@@ -234,7 +242,9 @@ if __name__ == '__main__':
changelog = get_changelog_from_tarball(args.filename)
changes_list = parse_changelog(changelog)
upstream_commit = get_upstream_commit(changelog)
- tarball_parent_dir, upstream_version = get_parent_dir_and_version_from_tarball(args.filename, args.version_regexp)
+ tarball_parent_dir, upstream_version = \
+ get_parent_dir_and_version_from_tarball(
+ args.filename, args.version_regexp)
package_commit = get_commit_from_spec(args.package)
package_version = package_version(upstream_version, upstream_commit)
View
@@ -0,0 +1 @@
+argparse
View
@@ -0,0 +1,3 @@
+mock
+nose
+pep8

0 comments on commit 04bfb48

Please sign in to comment.