forked from AFPy/powrap
Initial commit
This commit is contained in:
commit
b33b5eeeb1
|
@ -0,0 +1,62 @@
|
|||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*,cover
|
||||
.hypothesis/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# pyenv python configuration file
|
||||
.python-version
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017, Julien Palard
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
include LICENSE
|
||||
include README.rst
|
||||
|
||||
recursive-include tests *
|
||||
recursive-exclude * __pycache__
|
||||
recursive-exclude * *.py[co]
|
||||
|
||||
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
|
|
@ -0,0 +1,18 @@
|
|||
========
|
||||
poindent
|
||||
========
|
||||
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/poindent.svg
|
||||
:target: https://pypi.python.org/pypi/poindent
|
||||
|
||||
Script to fix indentation of given ``.po`` files. If ``--modified`` is
|
||||
given, it will only fix modified files according to git (usefull if
|
||||
your ``.po`` files are versionned).
|
||||
|
||||
|
||||
This package only runs ``msgcat`` from the ``gettext`` package, so if
|
||||
your distribution don't have it, it just won't work.
|
||||
|
||||
|
||||
* Free software: MIT license
|
|
@ -0,0 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
__author__ = """Julien Palard"""
|
||||
__email__ = 'julien@palard.fr'
|
||||
__version__ = '0.1.0'
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""Fix style of uncommited po files, or all if --all is given.
|
||||
|
||||
The "tac|tac" trick is an equivalent to "sponge" but as tac is in
|
||||
coreutils we're avoiding you to install a new packet. Without
|
||||
`tac|tac` or `sponge`, `msgcat` may start to write in the po file
|
||||
before having finised to read it, yielding unpredictible behavior.
|
||||
(Yep we also can write to another file and mv it, like sed -i does.)
|
||||
"""
|
||||
|
||||
from shlex import quote
|
||||
from subprocess import check_output
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
def fix_style(po_files, modified=False, no_wrap=False):
|
||||
"""Fix style of unversionned ``.po`` files, or or all f
|
||||
"""
|
||||
if modified:
|
||||
git_status = check_output(["git", "status", "--porcelain"],
|
||||
universal_newlines=True)
|
||||
git_status_lines = [line.split(maxsplit=2) for line in
|
||||
git_status.split('\n')
|
||||
if line]
|
||||
po_files.extend(filename for status, filename in git_status_lines
|
||||
if filename.endswith('.po'))
|
||||
for po_file in tqdm(po_files, desc="Fixing indentation in po files"):
|
||||
check_output('tac {} | tac | msgcat - -o {} {}'.format(
|
||||
quote(po_file), quote(po_file), '--no-wrap' if no_wrap else ''),
|
||||
shell=True)
|
||||
|
||||
|
||||
def main():
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Ensure po files are using the standard gettext format')
|
||||
parser.add_argument('--modified', '-m', action='store_true',
|
||||
help='Use git to find modified files.')
|
||||
parser.add_argument('--no-wrap', action='store_true',
|
||||
help='see `man msgcat`, usefull to sed right after.')
|
||||
parser.add_argument('po_files', nargs='*', help='po files.')
|
||||
args = parser.parse_args()
|
||||
if not args.po_files and not args.modified:
|
||||
parser.print_help()
|
||||
exit(1)
|
||||
fix_style(args.po_files, args.modified, args.no_wrap)
|
|
@ -0,0 +1,3 @@
|
|||
pip==8.1.2
|
||||
wheel==0.29.0
|
||||
flake8==2.6.0
|
|
@ -0,0 +1,18 @@
|
|||
[bumpversion]
|
||||
current_version = 0.1.0
|
||||
commit = True
|
||||
tag = True
|
||||
|
||||
[bumpversion:file:setup.py]
|
||||
search = version='{current_version}'
|
||||
replace = version='{new_version}'
|
||||
|
||||
[bumpversion:file:poindent/__init__.py]
|
||||
search = __version__ = '{current_version}'
|
||||
replace = __version__ = '{new_version}'
|
||||
|
||||
[bdist_wheel]
|
||||
universal = 1
|
||||
|
||||
[flake8]
|
||||
exclude = docs
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
with open('README.rst') as readme_file:
|
||||
readme = readme_file.read()
|
||||
|
||||
requirements = [
|
||||
'tqdm'
|
||||
]
|
||||
|
||||
setup(
|
||||
name='poindent',
|
||||
version='0.1.0',
|
||||
description="Find an properly reindent .po files.",
|
||||
long_description=readme,
|
||||
author="Julien Palard",
|
||||
author_email='julien@palard.fr',
|
||||
url='https://github.com/JulienPalard/poindent',
|
||||
packages=[
|
||||
'poindent',
|
||||
],
|
||||
package_dir={'poindent':
|
||||
'poindent'},
|
||||
entry_points={
|
||||
'console_scripts': ['poindent=poindent.poindent:main']
|
||||
},
|
||||
include_package_data=True,
|
||||
install_requires=requirements,
|
||||
license="MIT license",
|
||||
zip_safe=False,
|
||||
keywords='poindent',
|
||||
classifiers=[
|
||||
'Development Status :: 2 - Pre-Alpha',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Natural Language :: English',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6'
|
||||
]
|
||||
)
|
Loading…
Reference in New Issue