[Python-modules-commits] [transifex-client] 06/08: Imported Upstream version 0.11.1+git15~g655c5e9
Hans-Christoph Steiner
eighthave at moszumanska.debian.org
Wed Feb 17 22:38:38 UTC 2016
This is an automated email from the git hooks/post-receive script.
eighthave pushed a commit to branch master
in repository transifex-client.
commit 1f27e3060adb2be55c914d37e7320aff257d6a91
Author: Hans-Christoph Steiner <hans at eds.org>
Date: Wed Feb 17 23:31:54 2016 +0100
Imported Upstream version 0.11.1+git15~g655c5e9
---
.gitignore | 7 +
DEVELOPMENT.rst | 21 +
MANIFEST.in | 1 +
PKG-INFO | 45 --
README.rst | 57 +-
appveyor.yml | 75 +++
circle.yml | 17 +
contrib/test_build.sh | 5 +
contrib/test_win_build.sh | 11 +
contrib/tx.ico | Bin 0 -> 24870 bytes
contrib/tx.spec | 29 +
contrib/tx_commands.sh | 17 +
requirements.txt | 1 +
setup.cfg | 5 -
setup.py | 70 +-
tests/test_project.py | 130 +++-
tox.ini | 12 +
transifex_client.egg-info/PKG-INFO | 45 --
transifex_client.egg-info/SOURCES.txt | 45 --
transifex_client.egg-info/dependency_links.txt | 1 -
transifex_client.egg-info/not-zip-safe | 1 -
transifex_client.egg-info/top_level.txt | 1 -
txclib/__init__.py | 12 +-
txclib/__main__.py | 5 +
tx => txclib/cmdline.py | 35 +-
txclib/commands.py | 183 ++---
txclib/config.py | 20 +-
txclib/log.py | 2 +-
txclib/packages/__init__.py | 0
txclib/packages/urllib3/__init__.py | 58 --
txclib/packages/urllib3/_collections.py | 94 ---
txclib/packages/urllib3/connectionpool.py | 745 ---------------------
txclib/packages/urllib3/contrib/__init__.py | 0
txclib/packages/urllib3/contrib/ntlmpool.py | 120 ----
txclib/packages/urllib3/contrib/pyopenssl.py | 344 ----------
txclib/packages/urllib3/exceptions.py | 121 ----
txclib/packages/urllib3/fields.py | 177 -----
txclib/packages/urllib3/filepost.py | 101 ---
txclib/packages/urllib3/packages/__init__.py | 4 -
txclib/packages/urllib3/packages/ordered_dict.py | 260 -------
txclib/packages/urllib3/packages/six.py | 385 -----------
.../packages/ssl_match_hostname/__init__.py | 98 ---
txclib/packages/urllib3/poolmanager.py | 259 -------
txclib/packages/urllib3/request.py | 142 ----
txclib/packages/urllib3/response.py | 301 ---------
txclib/packages/urllib3/util.py | 626 -----------------
txclib/parsers.py | 284 ++++----
txclib/project.py | 274 ++++----
txclib/urls.py | 2 +
txclib/utils.py | 71 +-
txclib/web.py | 18 +-
51 files changed, 852 insertions(+), 4485 deletions(-)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..508cc21
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+.tx
+*pyc
+*pyo
+*~
+*egg-info*
+/build
+/dist
diff --git a/DEVELOPMENT.rst b/DEVELOPMENT.rst
new file mode 100644
index 0000000..992e518
--- /dev/null
+++ b/DEVELOPMENT.rst
@@ -0,0 +1,21 @@
+Releasing
+=========
+
+To create a new release:
+
+1. Update local rep and update the version in ``setup.py``::
+
+ $ hg pull -u
+ $ vim setup.py
+
+2. Test::
+
+ $ python setup.py clean sdist
+ $ cd dist
+ $ tar zxf ...
+ $ cd transifex-client
+ ...test
+
+3. Package and upload on PyPI::
+
+ $ python setup.py clean sdist bdist_egg upload
diff --git a/MANIFEST.in b/MANIFEST.in
index 0e6f0c3..4f0a350 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,6 @@
include tx
include txclib/cacert.pem
+include requirements.txt
# Docs
include LICENSE README.rst
diff --git a/PKG-INFO b/PKG-INFO
deleted file mode 100644
index e00ad75..0000000
--- a/PKG-INFO
+++ /dev/null
@@ -1,45 +0,0 @@
-Metadata-Version: 1.1
-Name: transifex-client
-Version: 0.11.1.beta
-Summary: A command line interface for Transifex
-Home-page: https://www.transifex.com
-Author: Transifex
-Author-email: admin at transifex.com
-License: GPLv2
-Description:
- =============================
- Transifex Command-Line Tool
- =============================
-
- 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.
-
- You can use the command line client to easily create new resources, map
- locale files to translations and synchronize your Transifex project with
- your local repository and vice verca. Translators and localization
- managers can also use it to handle large volumes of translation files
- easily and without much hassle.
-
- Check the full documentation at
- http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles.
-
-
- Installing
- ==========
-
- You can install the latest version of transifex-client running ``pip
- install transifex-client`` or ``easy_install transifex-client``
- You can also install the `in-development version`_ of transifex-client
- with ``pip install transifex-client==dev`` or ``easy_install
- transifex-client==dev``.
-
- .. _in-development version: http://github.com/transifex/transifex-client/tarball/master#egg=transifex-client-dev
-
-Keywords: translation,localization,internationalization
-Platform: UNKNOWN
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
diff --git a/README.rst b/README.rst
index 0ed076d..60202b1 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,8 @@
+.. image:: https://circleci.com/gh/transifex/transifex-client/tree/master.svg?style=shield&circle-token=33aafd984726261eff1b73278a0cf761382c478a
+ :target: https://circleci.com/gh/transifex/transifex-client/tree/master
+.. image:: https://ci.appveyor.com/api/projects/status/github/transifex/transifex-client?branch=master&svg=true
+ :target: https://ci.appveyor.com/project/transifex/transifex-client/branch/master
+
=============================
Transifex Command-Line Tool
@@ -14,16 +19,56 @@ managers can also use it to handle large volumes of translation files
easily and without much hassle.
Check the full documentation at
-http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles.
+http://docs.transifex.com/client/
Installing
==========
You can install the latest version of transifex-client running ``pip
-install transifex-client`` or ``easy_install transifex-client``
-You can also install the `in-development version`_ of transifex-client
-with ``pip install transifex-client==dev`` or ``easy_install
-transifex-client==dev``.
+install transifex-client`` or ``easy_install transifex-client``.
+
+
+Build transifex-client for Windows
+==================================
+
+1. Download transifex-client sources via git or github archive.
+
+ a. ``git clone https://github.com/transifex/transifex-client.git``
+ b. Download and unpack https://github.com/transifex/transifex-client/archive/master.zip
+
+2. Download and install Python_.
+
+ At this step choose right version of python: 2 or 3 and x86 or x86-64 instruction set.
+
+ Make sure pip marked for installation(default for latest installers).
+
+3. Install PyInstaller_.
+
+ Suppose that Python installed to ``C:\\Program Files\\Python35-32``
+
+ Make ``python.exe`` accessible via PATH environment variable or cd to directory containing python.exe.
+
+ ::
+
+ python -m pip install pyinstaller
+
+ This command will install ``PyInstaller`` package and its dependencies.
+
+4. Build ``transifex-client`` distribution.
+
+ Change directory to transifex-client folder and run command:
+
+ ::
+
+ python -m PyInstaller contrib/tx.spec
+ # or
+ pyinstaller contrib/tx.spec
+
+5. ``tx.exe``
+
+ ``dist/tx.exe`` will be created as the result of build process.
+
-.. _in-development version: http://github.com/transifex/transifex-client/tarball/master#egg=transifex-client-dev
+.. _Python: https://www.python.org/downloads/windows/
+.. _PyInstaller: http://www.pyinstaller.org
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..1854a81
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,75 @@
+environment:
+ global:
+ # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
+ # /E:ON and /V:ON options are not enabled in the batch script intepreter
+ # See: http://stackoverflow.com/a/13751649/163740
+ CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
+
+ matrix:
+
+ - PYTHON: "C:\\Python27"
+ PYTHON_VERSION: "2.7.x"
+ PYTHON_ARCH: "32"
+
+ - PYTHON: "C:\\Python27-x64"
+ PYTHON_VERSION: "2.7.x"
+ PYTHON_ARCH: "64"
+
+ - PYTHON: "C:\\Python35"
+ PYTHON_VERSION: "3.5.x"
+ PYTHON_ARCH: "32"
+
+ - PYTHON: "C:\\Python35-x64"
+ PYTHON_VERSION: "3.5.x"
+ PYTHON_ARCH: "64"
+
+
+install:
+ - ECHO "Filesystem root:"
+ - ps: "ls \"C:/\""
+
+ # Prepend newly installed Python to the PATH of this build (this cannot be
+ # done from inside the powershell script as it would require to restart
+ # the parent CMD process).
+ - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
+
+ # Check that we have the expected version and architecture for Python
+ - "python --version"
+ - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
+
+ # Upgrade to the latest version of pip to avoid it displaying warnings
+ # about it being out of date.
+ - "pip install --disable-pip-version-check --user --upgrade pip"
+ - "pip install pyinstaller"
+
+ # Set up the project in develop mode. If some dependencies contain
+ # compiled extensions and are not provided as pre-built wheel packages,
+ # pip will build them from source using the MSVC compiler matching the
+ # target Python version and architecture
+ - pip install -e .
+
+build_script:
+ # Build the compiled extension
+ #- "%CMD_IN_ENV% python setup.py build"
+ - pyinstaller contrib/tx.spec
+
+test_script:
+ # Run the project tests
+ #- "%CMD_IN_ENV% python setup.py nosetests"
+ - bash contrib/test_win_build.sh
+
+after_test:
+ # If tests are successful, create binary packages for the project.
+ #- "%CMD_IN_ENV% python setup.py bdist_wheel"
+ #- "%CMD_IN_ENV% python setup.py bdist_wininst"
+ #- "%CMD_IN_ENV% python setup.py bdist_msi"
+ - ps: "ls dist"
+
+artifacts:
+ # Archive the generated packages in the ci.appveyor.com build report.
+ - path: dist\*
+
+#on_success:
+# - TODO: upload the content of dist/*.whl to a public wheelhouse
+#
+
diff --git a/circle.yml b/circle.yml
new file mode 100644
index 0000000..adda24e
--- /dev/null
+++ b/circle.yml
@@ -0,0 +1,17 @@
+machine:
+ environment:
+ TOX_PY27: '2.7.10'
+ TOX_PY35: '3.5.0'
+
+dependencies:
+ override:
+ - pip -V
+ - pip install -U pip
+ - pip install -U ipdb
+ - pip install -U tox
+ - pip install -U tox-pyenv
+ - pyenv local $TOX_PY27 $TOX_PY35
+
+test:
+ override:
+ - tox -v --recreate
diff --git a/contrib/test_build.sh b/contrib/test_build.sh
new file mode 100755
index 0000000..930ef33
--- /dev/null
+++ b/contrib/test_build.sh
@@ -0,0 +1,5 @@
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+BRANCH="linux_osx"
+TX=`which tx`
+echo $TX
+source "$DIR/tx_commands.sh"
diff --git a/contrib/test_win_build.sh b/contrib/test_win_build.sh
new file mode 100644
index 0000000..7520cdc
--- /dev/null
+++ b/contrib/test_win_build.sh
@@ -0,0 +1,11 @@
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+BRANCH="win-${PYTHON//C:\\/}"
+
+# Test the PyInstaller executable:
+TX="$DIR/../dist/tx.exe"
+source "$DIR/tx_commands.sh"
+
+# Test the Setuptools script:
+TX="tx"
+source "$DIR/tx_commands.sh"
+
diff --git a/contrib/tx.ico b/contrib/tx.ico
new file mode 100644
index 0000000..ade1963
Binary files /dev/null and b/contrib/tx.ico differ
diff --git a/contrib/tx.spec b/contrib/tx.spec
new file mode 100644
index 0000000..b743f1b
--- /dev/null
+++ b/contrib/tx.spec
@@ -0,0 +1,29 @@
+# -*- mode: python -*-
+
+block_cipher = None
+added_files = [
+ ('../txclib/cacert.pem', 'txclib'),
+]
+
+a = Analysis(['../txclib/cmdline.py'],
+ binaries=None,
+ datas=added_files,
+ hiddenimports=[],
+ hookspath=None,
+ runtime_hooks=None,
+ excludes=None,
+ win_no_prefer_redirects=None,
+ win_private_assemblies=None,
+ cipher=block_cipher)
+pyz = PYZ(a.pure, a.zipped_data,
+ cipher=block_cipher)
+exe = EXE(pyz,
+ a.scripts,
+ a.binaries,
+ a.zipfiles,
+ a.datas,
+ name='tx',
+ debug=False,
+ strip=None,
+ upx=False,
+ console=True , icon='contrib/tx.ico')
diff --git a/contrib/tx_commands.sh b/contrib/tx_commands.sh
new file mode 100644
index 0000000..0e0e9ce
--- /dev/null
+++ b/contrib/tx_commands.sh
@@ -0,0 +1,17 @@
+if [[ -z "$TRANSIFEX_USER" ]] ; then
+ echo "NB: Skipping tests of $TX since TRANSIFEX_USER is undefined or empty"
+ exit 0
+fi
+
+# Exit on fail
+set -e
+
+rm -rf txci
+git clone https://github.com/diegobz/txci.git
+cd txci
+rm -rf .tx
+$TX init --host="https://www.transifex.com" --user=$TRANSIFEX_USER --pass=$TRANSIFEX_PASSWORD
+$TX set --auto-local -r txci.$BRANCH -s en 'locale/<lang>/LC_MESSAGES/django.po' -t PO --execute
+$TX --traceback push -s
+$TX --traceback pull -l pt_BR -f
+$TX --traceback delete -f
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..a42590b
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+urllib3
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 861a9f5..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[egg_info]
-tag_build =
-tag_date = 0
-tag_svn_revision = 0
-
diff --git a/setup.py b/setup.py
index d7bec14..5bb1452 100755
--- a/setup.py
+++ b/setup.py
@@ -1,73 +1,35 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-import os.path
-import io
+from codecs import open
from setuptools import setup
-from txclib import get_version
+import txclib
-readme_file = io.open('README.rst', 'rt', encoding='UTF-8')
-long_description = readme_file.read()
-readme_file.close()
-package_data = {
- '': ['LICENSE', 'README.rst'],
- 'txclib': ['*.pem'],
-}
-
-scripts = ['tx']
-
-install_requires = []
-extra_args = {}
-import platform
-if platform.system() == 'Windows':
- from py2exe.build_exe import py2exe as build_exe
-
- class MediaCollector(build_exe):
- # See http://crazedmonkey.com/blog/python/pkg_resources-with-py2exe.html
- def copy_extensions(self, extensions):
- build_exe.copy_extensions(self, extensions)
- self.copy_file(
- 'txclib/cacert.pem',
- os.path.join(self.collect_dir, 'txclib/cacert.pem')
- )
- self.compiled_files.append('txclib/cacert.pem')
-
- extra_args = {
- 'console': ['tx'],
- 'options': {'py2exe': {'bundle_files': 1}},
- 'zipfile': None,
- 'cmdclass': {'py2exe': MediaCollector},
- }
+def get_file_content(filename):
+ with open(filename, 'r', encoding='UTF-8') as f:
+ return f.read()
setup(
name="transifex-client",
- version=get_version(),
- scripts=scripts,
+ version=txclib.__version__,
+ entry_points={'console_scripts': ['tx=txclib.cmdline:main']},
description="A command line interface for Transifex",
- long_description=long_description,
+ long_description=get_file_content('README.rst'),
author="Transifex",
author_email="admin at transifex.com",
url="https://www.transifex.com",
license="GPLv2",
- dependency_links=[
- ],
- setup_requires=[
- ],
- install_requires=install_requires,
- tests_require=["mock", ],
- data_files=[
- ],
+ dependency_links=[],
+ setup_requires=[],
+ install_requires=get_file_content('requirements.txt').splitlines(),
+ tests_require=["mock"],
+ data_files=[],
test_suite="tests",
zip_safe=False,
- packages=[
- 'txclib', 'txclib.packages', 'txclib.packages.urllib3',
- 'txclib.packages.urllib3.contrib',
- 'txclib.packages.urllib3.packages',
- 'txclib.packages.urllib3.packages.ssl_match_hostname',
- ],
+ packages=['txclib'],
include_package_data=True,
- package_data=package_data,
+ package_data={},
keywords=('translation', 'localization', 'internationalization',),
classifiers=[
'Programming Language :: Python',
@@ -75,6 +37,6 @@ setup(
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.5',
],
- **extra_args
)
diff --git a/tests/test_project.py b/tests/test_project.py
index 6d61316..beb9c65 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -45,7 +45,7 @@ class TestProject(unittest.TestCase):
['proj1.res1', ],
['proj1.res1', ],
['transifex.txn', 'transifex.txo', ],
- ['proj1.res1', 'proj2.res2', 'transifex.txn', 'transifex.txo', ],
+ ['proj1.res1', 'proj2.res2', 'transifex.txn', 'transifex.txo', ], # noqa
['transifex.txo', ],
['transifex.txn', 'transifex.txo', ],
['transifex.txn', ],
@@ -73,82 +73,132 @@ class TestProjectMinimumPercent(unittest.TestCase):
def test_cmd_option(self):
"""Test command-line option."""
self.p.minimum_perc = 20
- results = itertools.cycle([80, 90 ])
+ results = itertools.cycle([80, 90])
+
def side_effect(*args):
return next(results)
with patch.object(self.p, "get_resource_option") as mock:
mock.side_effect = side_effect
- self.assertFalse(self.p._satisfies_min_translated({'completed': '12%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '20%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '30%'}))
+ self.assertFalse(
+ self.p._satisfies_min_translated({'completed': '12%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '20%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '30%'})
+ )
def test_global_only(self):
"""Test only global option."""
- results = itertools.cycle([80, None ])
+ results = itertools.cycle([80, None])
+
def side_effect(*args):
return next(results)
with patch.object(self.p, "get_resource_option") as mock:
mock.side_effect = side_effect
- self.assertFalse(self.p._satisfies_min_translated({'completed': '70%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '80%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '90%'}))
+ self.assertFalse(
+ self.p._satisfies_min_translated({'completed': '70%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '80%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '90%'})
+ )
def test_local_lower_than_global(self):
"""Test the case where the local option is lower than the global."""
- results = itertools.cycle([80, 70 ])
+ results = itertools.cycle([80, 70])
+
def side_effect(*args):
return next(results)
with patch.object(self.p, "get_resource_option") as mock:
mock.side_effect = side_effect
- self.assertFalse(self.p._satisfies_min_translated({'completed': '60%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '70%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '80%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '90%'}))
+ self.assertFalse(
+ self.p._satisfies_min_translated({'completed': '60%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '70%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '80%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '90%'})
+ )
def test_local_higher_than_global(self):
"""Test the case where the local option is lower than the global."""
- results = itertools.cycle([60, 70 ])
+ results = itertools.cycle([60, 70])
+
def side_effect(*args):
return next(results)
with patch.object(self.p, "get_resource_option") as mock:
mock.side_effect = side_effect
- self.assertFalse(self.p._satisfies_min_translated({'completed': '60%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '70%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '80%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '90%'}))
+ self.assertFalse(
+ self.p._satisfies_min_translated({'completed': '60%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '70%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '80%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '90%'})
+ )
def test_local_only(self):
"""Test the case where the local option is lower than the global."""
- results = itertools.cycle([None, 70 ])
+ results = itertools.cycle([None, 70])
+
def side_effect(*args):
return next(results)
with patch.object(self.p, "get_resource_option") as mock:
mock.side_effect = side_effect
- self.assertFalse(self.p._satisfies_min_translated({'completed': '60%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '70%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '80%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '90%'}))
+ self.assertFalse(
+ self.p._satisfies_min_translated({'completed': '60%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '70%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '80%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '90%'})
+ )
def test_no_option(self):
""""Test the case there is nothing defined."""
- results = itertools.cycle([None, None ])
+ results = itertools.cycle([None, None])
+
def side_effect(*args):
return next(results)
with patch.object(self.p, "get_resource_option") as mock:
mock.side_effect = side_effect
- self.assertTrue(self.p._satisfies_min_translated({'completed': '0%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '10%'}))
- self.assertTrue(self.p._satisfies_min_translated({'completed': '90%'}))
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '0%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '10%'})
+ )
+ self.assertTrue(
+ self.p._satisfies_min_translated({'completed': '90%'})
+ )
class TestProjectFilters(unittest.TestCase):
- """Test filters used to decide whether to push/pull a translation or not."""
+ """
+ Test filters used to decide whether to push/pull a translation or not.
+ """
def setUp(self):
super(TestProjectFilters, self).setUp()
@@ -213,6 +263,7 @@ class TestProjectFilters(unittest.TestCase):
# older local files
local_times = [self.p._generate_timestamp('2011-11-01 14:00:59')]
results = itertools.cycle(local_times)
+
def side_effect(*args):
return next(results)
@@ -228,6 +279,7 @@ class TestProjectFilters(unittest.TestCase):
# newer local files
local_times = [self.p._generate_timestamp('2011-11-01 15:01:59')]
results = itertools.cycle(local_times)
+
def side_effect(*args):
return next(results)
@@ -241,7 +293,9 @@ class TestProjectFilters(unittest.TestCase):
)
def test_push_translation(self):
- """Test filters for pushing a translation file."""
+ """
+ Test filters for pushing a translation file.
+ """
with patch.object(self.p, "get_resource_option") as mock:
mock.return_value = None
@@ -249,9 +303,13 @@ class TestProjectFilters(unittest.TestCase):
should_push = self.p._should_push_translation
force = True
for lang in self.langs:
- self.assertTrue(should_push(lang, self.stats, local_file, force))
+ self.assertTrue(
+ should_push(
+ lang, self.stats, local_file, force
+ )
+ )
- force = False # reminder
+ force = False # reminder
# unknown language
self.assertTrue(should_push('es', self.stats, local_file))
@@ -259,6 +317,7 @@ class TestProjectFilters(unittest.TestCase):
# older local files
local_times = [self.p._generate_timestamp('2011-11-01 14:00:59')]
results = itertools.cycle(local_times)
+
def side_effect(*args):
return next(results)
@@ -274,6 +333,7 @@ class TestProjectFilters(unittest.TestCase):
# newer local files
local_times = [self.p._generate_timestamp('2011-11-01 15:01:59')]
results = itertools.cycle(local_times)
+
def side_effect(*args):
return next(results)
@@ -327,11 +387,13 @@ class TestProjectPull(unittest.TestCase):
)
self.assertEqual(res, set([]))
- with patch.object(self.p, '_should_add_translation') as filter_mock:
+ with patch.object(self.p,
+ '_should_add_translation') as filter_mock:
filter_mock.return_value = True
for force in [True, False]:
res = new_trans(
- {'el': None}, self.slang, self.lang_map, self.stats, force
+ {'el': None}, self.slang, self.lang_map, self.stats,
+ force
)
self.assertEqual(res, set(['pt']))
for force in [True, False]:
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..d0ef5f8
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,12 @@
+[tox]
+envlist = py27,py35
+
+[testenv]
+whitelist_externals = source
+ bash
+install_command = pip install -U {opts} {packages}
+setenv = TOX_ENV_NAME={envname}
+passenv = TOX_* TRANSIFEX_USER TRANSIFEX_PASSWORD CI_* APPVEYOR_*
+commands = python -V
+ python setup.py test
+ bash ./contrib/test_build.sh
diff --git a/transifex_client.egg-info/PKG-INFO b/transifex_client.egg-info/PKG-INFO
deleted file mode 100644
index e00ad75..0000000
--- a/transifex_client.egg-info/PKG-INFO
+++ /dev/null
@@ -1,45 +0,0 @@
-Metadata-Version: 1.1
-Name: transifex-client
-Version: 0.11.1.beta
-Summary: A command line interface for Transifex
-Home-page: https://www.transifex.com
-Author: Transifex
-Author-email: admin at transifex.com
-License: GPLv2
-Description:
- =============================
- Transifex Command-Line Tool
- =============================
-
- 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.
-
- You can use the command line client to easily create new resources, map
- locale files to translations and synchronize your Transifex project with
- your local repository and vice verca. Translators and localization
- managers can also use it to handle large volumes of translation files
- easily and without much hassle.
-
- Check the full documentation at
- http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles.
-
-
- Installing
- ==========
-
- You can install the latest version of transifex-client running ``pip
- install transifex-client`` or ``easy_install transifex-client``
- You can also install the `in-development version`_ of transifex-client
- with ``pip install transifex-client==dev`` or ``easy_install
- transifex-client==dev``.
-
- .. _in-development version: http://github.com/transifex/transifex-client/tarball/master#egg=transifex-client-dev
-
-Keywords: translation,localization,internationalization
-Platform: UNKNOWN
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
diff --git a/transifex_client.egg-info/SOURCES.txt b/transifex_client.egg-info/SOURCES.txt
deleted file mode 100644
index f1471d1..0000000
--- a/transifex_client.egg-info/SOURCES.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-LICENSE
-MANIFEST.in
-README.rst
-setup.py
-tx
-tests/__init__.py
-tests/test_paths.py
-tests/test_processors.py
-tests/test_project.py
-transifex_client.egg-info/PKG-INFO
-transifex_client.egg-info/SOURCES.txt
-transifex_client.egg-info/dependency_links.txt
-transifex_client.egg-info/not-zip-safe
-transifex_client.egg-info/top_level.txt
-txclib/__init__.py
-txclib/cacert.pem
-txclib/commands.py
-txclib/config.py
-txclib/exceptions.py
-txclib/log.py
-txclib/parsers.py
-txclib/paths.py
-txclib/processors.py
-txclib/project.py
-txclib/urls.py
-txclib/utils.py
-txclib/web.py
-txclib/packages/__init__.py
-txclib/packages/urllib3/__init__.py
-txclib/packages/urllib3/_collections.py
-txclib/packages/urllib3/connectionpool.py
-txclib/packages/urllib3/exceptions.py
-txclib/packages/urllib3/fields.py
-txclib/packages/urllib3/filepost.py
-txclib/packages/urllib3/poolmanager.py
-txclib/packages/urllib3/request.py
-txclib/packages/urllib3/response.py
-txclib/packages/urllib3/util.py
-txclib/packages/urllib3/contrib/__init__.py
-txclib/packages/urllib3/contrib/ntlmpool.py
-txclib/packages/urllib3/contrib/pyopenssl.py
-txclib/packages/urllib3/packages/__init__.py
-txclib/packages/urllib3/packages/ordered_dict.py
-txclib/packages/urllib3/packages/six.py
-txclib/packages/urllib3/packages/ssl_match_hostname/__init__.py
\ No newline at end of file
diff --git a/transifex_client.egg-info/dependency_links.txt b/transifex_client.egg-info/dependency_links.txt
deleted file mode 100644
index 8b13789..0000000
--- a/transifex_client.egg-info/dependency_links.txt
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/transifex_client.egg-info/not-zip-safe b/transifex_client.egg-info/not-zip-safe
deleted file mode 100644
index 8b13789..0000000
--- a/transifex_client.egg-info/not-zip-safe
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/transifex_client.egg-info/top_level.txt b/transifex_client.egg-info/top_level.txt
deleted file mode 100644
index 5561019..0000000
--- a/transifex_client.egg-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-txclib
diff --git a/txclib/__init__.py b/txclib/__init__.py
index 5a87c84..7926bec 100644
--- a/txclib/__init__.py
+++ b/txclib/__init__.py
@@ -1,12 +1,4 @@
# -*- coding: utf-8 -*-
-VERSION = (0, 11, 1, 'beta')
-
-
-def get_version():
- version = '%s.%s' % (VERSION[0], VERSION[1])
- if VERSION[2]:
- version = '%s.%s' % (version, VERSION[2])
- if VERSION[3] != 'final':
- version = '%s %s' % (version, VERSION[3])
- return version
+# https://www.python.org/dev/peps/pep-0440/#examples-of-compliant-version-schemes
+__version__ = '0.11'
diff --git a/txclib/__main__.py b/txclib/__main__.py
new file mode 100644
index 0000000..9c5f8d6
--- /dev/null
+++ b/txclib/__main__.py
@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+
+from .cmdline import main
+
+main()
diff --git a/tx b/txclib/cmdline.py
similarity index 77%
rename from tx
rename to txclib/cmdline.py
index bbcc21a..7eba1b7 100755
--- a/tx
+++ b/txclib/cmdline.py
@@ -1,21 +1,21 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from optparse import OptionParser, OptionValueError
import os
import sys
-import errno
+from optparse import OptionParser
+from urllib3.exceptions import SSLError
+
+import txclib
from txclib import utils
-from txclib import get_version
from txclib.log import set_log_level, logger
-from txclib.packages.urllib3.exceptions import SSLError
# This block ensures that ^C interrupts are handled quietly.
try:
import signal
... 5789 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/transifex-client.git
More information about the Python-modules-commits
mailing list