[packages/transifex-client: 1/2] new, version 0.10
glen
glen at pld-linux.org
Sun Apr 23 20:13:42 CEST 2017
commit 16e49bd38b027291cec7ab4825d9440a63db93d5
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sun Apr 23 21:09:40 2017 +0300
new, version 0.10
based on fedora package, 67be10d
transifex-client-resource-creation.patch | 37 +++++++++++++++++++++++++
transifex-client.spec | 46 ++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+)
---
diff --git a/transifex-client.spec b/transifex-client.spec
new file mode 100644
index 0000000..99de2c9
--- /dev/null
+++ b/transifex-client.spec
@@ -0,0 +1,46 @@
+%define module txclib
+%define egg_name transifex_client
+%define pypi_name transifex-client
+Summary: Command line tool for Transifex translation management
+Name: transifex-client
+Version: 0.10
+Release: 0.1
+License: GPL v2
+Group: Development/Languages
+Source0: http://pypi.python.org/packages/source/t/transifex-client/%{name}-%{version}.tar.gz
+# Source0-md5: 5549538d84b8eede6b254cd81ae024fa
+URL: http://transifex.org
+Patch1: %{name}-resource-creation.patch
+BuildRequires: python-setuptools
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+Requires: python-backports-ssl_match_hostname
+Requires: python-setuptools
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+The Transifex Command-line Client is a command line tool that enables
+you to easily manage your translations within a project without the
+need of an elaborate UI system.
+
+%prep
+%setup -q
+%patch1 -p1
+
+%build
+%py_build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%py_install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.rst
+%attr(755,root,root) %{_bindir}/tx
+%{py_sitescriptdir}/%{module}
+%{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
diff --git a/transifex-client-resource-creation.patch b/transifex-client-resource-creation.patch
new file mode 100644
index 0000000..3fbbc47
--- /dev/null
+++ b/transifex-client-resource-creation.patch
@@ -0,0 +1,37 @@
+diff --git a/txclib/project.py b/txclib/project.py
+index b5c5049..08828c6 100644
+--- a/txclib/project.py
++++ b/txclib/project.py
+@@ -23,6 +23,10 @@ class ProjectNotInit(Exception):
+ pass
+
+
++class HttpNotFound(Exception):
++ pass
++
++
+ class Project(object):
+ """
+ Represents an association between the local and remote project instances.
+@@ -825,7 +829,10 @@ def do_url_request(self, api_call, multipart=False, data=None,
+
+ r.close()
+ if r.status < 200 or r.status >= 400:
+- raise Exception(r.data)
++ if r.status == 404:
++ raise HttpNotFound(r.data)
++ else:
++ raise Exception(r.data)
+ return r.data
+
+ def _should_update_translation(self, lang, stats, local_file, force=False,
+@@ -1080,6 +1087,9 @@ def _get_stats_for_resource(self):
+ r = self.do_url_request('resource_stats')
+ logger.debug("Statistics response is %s" % r)
+ stats = parse_json(r)
++ except HttpNotFound:
++ logger.debug("Resource not found, creating...")
++ stats = {}
+ except ssl.SSLError:
+ logger.error("Invalid SSL certificate")
+ raise
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/transifex-client.git/commitdiff/00e3b913916c2dbbcb144a0a2682c19690d395ba
More information about the pld-cvs-commit
mailing list