Python 3 does not have the print statement, so convert all
print statements to print functions and add an ugly duckling
unit test to detect regressions.
Add modules compat lib to support both python 2 and 3, and
add unit test to detect regressions.
Tito uses two modules that have changed significantly between
python 2 and 3:
* commands module merged into subprocess module
* ConfigParser module renamed as configparser
Exceptions are now compatible with both python 2.4 and 3.3,
and we have unit tests to detect regressions.
The syntax for capturing exceptions changed in python 3, but
we need to continue supporting python 2.4 syntax since many
people use tito on RHEL 5, which has python 2.4.
http://docs.python.org/dev/howto/pyporting.html#capturing-the-currently-raised-exception
These are the pep8 tests that break python3,
such as mixing tabs and spaces for indentation.
I ignored all the pep8 tests that seemed only stylistic,
such as "visual" indentation.
http://docs.python.org/3.3/reference/lexical_analysis.html
GitPython's git.util.get_user_id() calls os.getlogin(), which
throws an OSError if there is no tty:
Traceback (most recent call last):
File "/home/sandbox/test/functional/multiproject_tests.py", line 65, in setUp
TitoGitTestFixture.setUp(self)
File "/home/sandbox/test/functional/fixture.py", line 129, in setUp
index.commit('Setting offline.')
File "/usr/lib/python2.7/site-packages/git/index/base.py", line 887, in commit
return Commit.create_from_tree(self.repo, tree, message, parent_commits, head)
File "/usr/lib/python2.7/site-packages/git/objects/commit.py", line 303, in create_from_tree
committer = Actor.committer(cr)
File "/usr/lib/python2.7/site-packages/git/util.py", line 354, in committer
return cls._main_actor(cls.env_committer_name, cls.env_committer_email, config_reader)
File "/usr/lib/python2.7/site-packages/git/util.py", line 327, in _main_actor
default_email = get_user_id()
File "/usr/lib/python2.7/site-packages/git/util.py", line 120, in get_user_id
username = os.getlogin()
OSError: [Errno 25] Inappropriate ioctl for device
But GitPython also allows to avoid the call by setting
environment variable "USER" to anything other than "UNKNOWN".
Therefore we preempt GitPython by calling os.getlogin() ourselves.
If we have to rescue the exception, export the environment var to
avoid traceback.
* If a dev adds an editorconfig plugin to their editor,
automatically configure their editor for code style.
* Specify 4-space softtabs so new code will be compatible
with Python 3.
* Put the same settings in .gitattributes so git diff
highlights whitespace errors.
* travis-ci no longer supports python 2.5
http://blog.travis-ci.com/2013-11-18-upcoming-build-environment-updates/
> Python 2.5 has been removed due to very low overall usage and
> breaking changes in pip and virtualenv.
* GitPython
pip install no longer supports pre-release versions by default
http://www.pip-installer.org/en/latest/reference/pip_install.html#pre-release-versions
resolves build error:
$ pip install 'GitPython >= 0.2.0' --use-mirrors
--use-mirrors has been deprecated and will be removed in the future.
Explicit uses of --index-url and/or --extra-index-url is suggested.
Downloading/unpacking GitPython>=0.2.0
Could not find a version that satisfies the requirement
GitPython>=0.2.0 (from versions: 0.1.7, 0.2.0-beta1, 0.3.0-beta1,
0.3.0-beta2, 0.3.1-beta2, 0.3.2.RC1)
Cleaning up...
No distributions matching the version for GitPython>=0.2.0
When `python setup.py sdist` is run to generate a source tarball for
`rpmbuild`, it currently doesn't include some key files which causes
`rpmbuild` to fail. So add these to `MANIFEST.in`.
Instead of passing package specific and global config around separately, parse
them as one config object where package specific can override global should the
same sections and properties exist.
If you maintain custom builders/releasers, they will need to have their
constructors updated.
This may have been a recent change in rpmbuild that caused this as the
_buildroot macro appears to be somewhat new. However it seems using topdir
accomplishes the same thing more thoroughly.
You can still reference as tito.builder.Class, but the actual class can be in a
separate module if desired. See __init__.py for the imports that make this
happen.
New builder will not require a tag to function, so we need to remove
assumptions in the CLI about looking it up beforehand and let the
builder itself handle this.
This allows the behaviour to be used in just about any tagger sub-class.
Behaviour will be triggered on the presence of the 'version_template'
section in tito.props.
Renamed config:
version -> version_template (section)
file -> destination_file
Separated the replacement of version and release, as caller may just
want one or the other. (it works fine if only one of the variables is
present in your template file) Release is more of an rpm concept so may
not always be wanted in this context.
Removed the notion of default template files, if you want to use this
you need to specify the configuration for it.
Added a functional test to make sure I keep it working.
so if it does not exist, create it. This is in-memory operation
and does not affect real file.
Also make disttag optional. If not defined use empty string.
addressing:
Building release in Copr...
Traceback (most recent call last):
File "/usr/bin/tito", line 23, in <module>
CLI().main(sys.argv[1:])
File "/usr/lib/python2.7/site-packages/tito/cli.py", line 94, in main
return module.main(argv)
File "/usr/lib/python2.7/site-packages/tito/cli.py", line 639, in main
scratch=self.options.scratch)
File "/usr/lib/python2.7/site-packages/tito/release.py", line 998, in release
self._koji_release()
File "/usr/lib/python2.7/site-packages/tito/copr.py", line 45, in _koji_release
KojiReleaser._koji_release(self)
File "/usr/lib/python2.7/site-packages/tito/release.py", line 1029, in _koji_release
disttag = self.builder.config.get(koji_tag, "disttag")
File "/usr/lib64/python2.7/ConfigParser.py", line 607, in get
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'copr'
based on KojiReleaser, with few minor changes in KojiReleaser to prevent
duplication of code.
To learn more about Copr see:
https://fedorahosted.org/copr/