[python-vcstools/el6] Update to release 0.1.36

Scott K Logan cottsay at fedoraproject.org
Sun Dec 14 22:50:14 UTC 2014


commit c40a9e235786f553738b172d581e784196f1f5de
Author: Scott K Logan <logans at cottsay.net>
Date:   Sun Dec 14 00:54:07 2014 -0800

    Update to release 0.1.36
    
    Also:
    - Update to python packaging guidelines
    - Add check section
    - Add patch for test fixes
    - Add bzr, git, mercurial and subversion to Requires

 .gitignore                              |    1 +
 python-vcstools-0.1.36-test-fixes.patch |   70 ++++++++++++++
 python-vcstools.spec                    |  153 +++++++++++++++++++++++++++----
 sources                                 |    2 +-
 4 files changed, 206 insertions(+), 20 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f7bad65..4cdf07b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
 /vcstools-vcstools-0.1.30-0-g963c121.tar.gz
 /vcstools-0.1.31-b40a0da.tar.gz
 /vcstools-0.1.32-7effcc5.tar.gz
+/vcstools-0.1.36-299bf21.tar.gz
diff --git a/python-vcstools-0.1.36-test-fixes.patch b/python-vcstools-0.1.36-test-fixes.patch
new file mode 100644
index 0000000..ebfcd2d
--- /dev/null
+++ b/python-vcstools-0.1.36-test-fixes.patch
@@ -0,0 +1,70 @@
+From 562de2be781eda9a1ef7c2cee36ba71296836070 Mon Sep 17 00:00:00 2001
+From: Scott K Logan <logans at cottsay.net>
+Date: Sun, 14 Dec 2014 04:21:27 -0800
+Subject: [PATCH] Fix test for git >= 1.8.2
+
+The behavior of --depth changed in 1.8.2. Previously, when --depth=n was specified,
+the most recent n + 1 commits were present in the clone. In 1.8.2 and newer, the most
+recent n commits are.
+
+See https://raw.githubusercontent.com/gitster/git/master/Documentation/RelNotes/1.8.2.txt
+---
+ test/test_git.py | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/test/test_git.py b/test/test_git.py
+index b250f8f..7921627 100644
+--- a/test/test_git.py
++++ b/test/test_git.py
+@@ -43,6 +43,7 @@
+ import threading
+ import time
+ 
++from distutils.version import LooseVersion
+ from vcstools import GitClient
+ from vcstools.vcs_base import VcsError
+ 
+@@ -236,9 +237,13 @@ def test_checkout_shallow(self):
+         self.assertEqual(client.get_branch(), "master")
+         self.assertEqual(client.get_branch_parent(), "master")
+         po = subprocess.Popen("git log --pretty=format:%H", shell=True, cwd=self.local_path, stdout=subprocess.PIPE)
+-        log = po.stdout.read().decode('UTF-8').splitlines()
+-        # shallow only contains last 2 commits
+-        self.assertEqual(2, len(log), log)
++        log = po.stdout.read().decode('UTF-8').strip().splitlines()
++        if LooseVersion(client.gitversion) >= LooseVersion('1.8.2'):
++            # shallow only contains last commit
++            self.assertEqual(1, len(log), log)
++        else:
++            # shallow only contains last 2 commits
++            self.assertEqual(2, len(log), log)
+ 
+     def test_checkout_specific_version_and_update(self):
+         url = self.remote_path
+From c3176b498266bbb06553f67896e342c2ce62ea73 Mon Sep 17 00:00:00 2001
+From: Scott K Logan <logans at cottsay.net>
+Date: Sun, 14 Dec 2014 04:23:40 -0800
+Subject: [PATCH] Fix race condition in testing
+
+If the git timeout test is run on a machine which can run many threads,
+the TCP server finishes the call to `handle` and resets the connection
+before the timeout has occurred, and the test fails.
+---
+ test/test_git.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/test/test_git.py b/test/test_git.py
+index 7921627..d577278 100644
+--- a/test/test_git.py
++++ b/test/test_git.py
+@@ -774,7 +774,9 @@ class GitTimeoutTest(unittest.TestCase):
+ 
+     class MuteHandler(BaseRequestHandler):
+         def handle(self):
+-            self.request.recv(1024)
++            data = True
++            while data:
++                data = self.request.recv(1024)
+ 
+     @classmethod
+     def setUpClass(self):
diff --git a/python-vcstools.spec b/python-vcstools.spec
index 7c1830c..59f959f 100644
--- a/python-vcstools.spec
+++ b/python-vcstools.spec
@@ -1,26 +1,50 @@
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-
-%global commit 7effcc53209eb7e9882219aeec7b30519ba870d5
+%global commit 299bf21181dfee6e20d710d9af83c20cba584d27
 %global shortcommit %(c=%{commit}; echo ${c:0:7})
 %global realname vcstools
 
+%if 0%{?fedora} > 12
+%global with_python3 1
+%else
+%{!?__python2: %global __python2 /usr/bin/python2}
+%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
+%{!?python2_version: %global python2_version %(%{__python2} -c "from sys import stdout, version; stdout.write(version[:3])")}
+%endif
+
 Name:           python-%{realname}
-Version:        0.1.32
+Version:        0.1.36
 Release:        1%{?dist}
 Summary:        Version Control System tools for Python
 
 License:        BSD
 URL:            http://www.ros.org/wiki/vcstools
 Source0:        https://github.com/%{realname}/%{realname}/archive/%{commit}/%{realname}-%{version}-%{shortcommit}.tar.gz
+# Fix some broken tests (submitted upstream)
+Patch0:         %{name}-0.1.36-test-fixes.patch
+
 BuildArch:      noarch
 
+BuildRequires:  bzr
+BuildRequires:  git
+BuildRequires:  mercurial
+BuildRequires:  python-coverage
 BuildRequires:  python-dateutil
 BuildRequires:  python-devel
+BuildRequires:  python-mock
+BuildRequires:  python-nose
+%if 0%{?rhel} && 0%{?rhel} <= 6
+BuildRequires:  python-sphinx10
+%else
 BuildRequires:  python-sphinx
+%endif
 BuildRequires:  PyYAML
+BuildRequires:  subversion
 
+Requires:       bzr
+Requires:       git
+Requires:       mercurial
 Requires:       python-dateutil
 Requires:       PyYAML
+Requires:       subversion
 
 %description
 The vcstools module provides a Python API for interacting with different 
@@ -29,37 +53,128 @@ for seamless interacting with Git, Mercurial (Hg), Bzr and SVN. The focus
 of the API is manipulating on-disk checkouts of source-controlled trees. 
 Its main use is to support the rosinstall tool.
 
+%if 0%{?with_python3}
+%package -n python3-%{realname}
+Summary: Version Control System tools for Python
+
+BuildRequires:  python3-coverage
+BuildRequires:  python3-dateutil
+BuildRequires:  python3-devel
+BuildRequires:  python3-mock
+BuildRequires:  python3-nose
+BuildRequires:  python3-setuptools
+BuildRequires:  python3-sphinx
+BuildRequires:  python3-PyYAML
+
+Requires:       bzr
+Requires:       git
+Requires:       mercurial
+Requires:       python3-dateutil
+Requires:       python3-PyYAML
+Requires:       subversion
+
+%description -n python3-%{realname}
+The vcstools module provides a Python API for interacting with different
+version control systems (VCS/SCMs). The VcsClient class provides an API
+for seamless interacting with Git, Mercurial (Hg), Bzr and SVN. The focus
+of the API is manipulating on-disk checkouts of source-controlled trees.
+Its main use is to support the rosinstall tool.
+%endif # with_python3
+
 %prep
 %setup -qn %{realname}-%{commit}
+%patch0 -p1
 sed -i 's/haiku/default/' doc/conf.py
 sed -i 's/:special-members://' doc/vcstools.rst
 
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
+%endif # with_python3
+
+find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'
+
 %build
-pushd doc
-make html
-%if ! 0%{?rhel}
-make man
+%{__python2} setup.py build
+%if 0%{?rhel} && 0%{?rhel} <= 6
+make -C doc html man SPHINXBUILD=sphinx-1.0-build
+%else
+make -C doc html man
 %endif
+rm -f doc/_build/html/.buildinfo
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+make -C doc html man SPHINXBUILD=sphinx-build-%{python3_version}
+rm -f doc/_build/html/.buildinfo
 popd
+%endif # with_python3
 
 %install
-%{__python} setup.py install --root $RPM_BUILD_ROOT
-%if ! 0%{?rhel}
-mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
-chmod -x doc/_build/man/vcstools.1
-install -p -m 0644 doc/_build/man/vcstools.1 $RPM_BUILD_ROOT%{_mandir}/man1/
+%{__python2} setup.py install --root %{buildroot}
+mkdir -p %{buildroot}%{_mandir}/man1
+chmod -x doc/_build/man/%{realname}.1
+install -p -m 0644 doc/_build/man/%{realname}.1 %{buildroot}%{_mandir}/man1/
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --root %{buildroot}
+rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests
+mkdir -p %{buildroot}%{_mandir}/man1
+chmod -x doc/_build/man/%{realname}.1
+install -p -m 0644 doc/_build/man/%{realname}.1 %{buildroot}%{_mandir}/man1/python3-%{realname}.1
+popd
+%endif # with_python3
+
+%check
+export GIT_AUTHOR_EMAIL="foo at example.com"
+export GIT_AUTHOR_NAME="Foo Bar"
+export GIT_COMMITTER_EMAIL="foo at example.com"
+export GIT_COMMITTER_NAME="Foo Bar"
+export HGUSER="Foo Bar <foo at example.com>"
+export LANG=en_US.UTF-8
+
+# Exclude 5 tests which access remote data
+# Exclude a test with a bad unicode conversion on python2.6 machines (filed upstream)
+%if "%{python2_version}" == "2.6"
+nosetests --with-coverage --cover-package %{realname} -w test \
+  -e "^(test_url_matches_with_shortcut|test_checkout|test_checkout_dir_exists|test_checkout_version|test_get_url_by_reading|test_shell_command_verbose)$"
+%else
+nosetests --with-coverage --cover-package %{realname} -w test \
+  -e "^(test_url_matches_with_shortcut|test_checkout|test_checkout_dir_exists|test_checkout_version|test_get_url_by_reading)$"
 %endif
-rm -rf doc/_build/html/.buildinfo
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+nosetests-%{python3_version} --with-coverage --cover-package %{realname} -w test \
+  -e "^(test_url_matches_with_shortcut|test_checkout|test_checkout_dir_exists|test_checkout_version|test_get_url_by_reading)$"
+popd
+%endif # with_python3
 
 %files
 %doc doc/_build/html LICENSE 
-%{python_sitelib}/%{realname}
-%{python_sitelib}/%{realname}-*.egg-info
-%if ! 0%{?rhel}
-%{_mandir}/man1/*.gz
-%endif
+%{python2_sitelib}/%{realname}
+%{python2_sitelib}/%{realname}-%{version}-py?.?.egg-info
+%{_mandir}/man1/%{realname}.1.gz
+
+%if 0%{?with_python3}
+%files -n python3-%{realname}
+%doc doc/_build/html LICENSE
+%{python3_sitelib}/%{realname}
+%{python3_sitelib}/%{realname}-%{version}-py?.?.egg-info
+%{_mandir}/man1/python3-%{realname}.1.gz
+%endif # with_python3
 
 %changelog
+* Sun Dec 14 2014 Scott K Logan <logans at cottsay.net> - 0.1.36-1
+- Update to release 0.1.36
+- Update to python packaging guidelines
+- Add check section
+- Add patch for test fixes
+- Add bzr, git, mercurial and subversion to Requires
+
 * Sat Feb 08 2014 Rich Mattes <richmattes at gmail.com> - 0.1.32-1
 - Update to release 0.1.32
 
diff --git a/sources b/sources
index 1400203..6cec6b9 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-e12423fb82843627fd076444db53411b  vcstools-0.1.32-7effcc5.tar.gz
+03dab58a8c8a5b112bd981d7194e0cb7  vcstools-0.1.36-299bf21.tar.gz


More information about the scm-commits mailing list