...
 
Commits (27)
language: python
python:
- "3.7"
- "3.6"
- "3.5"
- "3.4"
- "2.7"
matrix:
exclude:
- python: "3.7"
- python: "3.6"
- python: "3.5"
- python: "3.4"
- python: "2.7"
include:
- python: "3.6"
- python: "3.7"
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
env: TOXENV=flake8
- python: "3.6"
- python: "3.7"
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
env: TOXENV=sdist
- python: "3.7"
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
env: TOXENV=py37
- python: "3.6"
env: TOXENV=py36
- python: "3.5"
env: TOXENV=py35
- python: "3.4"
env: TOXENV=py34
- python: "2.7"
env: TOXENV=py27
install:
......
This diff is collapsed.
......@@ -33,7 +33,7 @@ This section describe to translate with Sphinx_ and `sphinx-intl` command.
4. Setup/Update your `locale_dir`::
$ sphinx-intl update -p _build/locale -l de -l ja
$ sphinx-intl update -p _build/gettext -l de -l ja
Done. You got these directories that contain po files:
......@@ -59,7 +59,7 @@ Basic Features
Requirements for basic
-----------------------
- Python 3.6, 3.5, 3.4, 2.7, pypy.
- Python 3.7, 3.6, 3.5, 2.7, pypy.
- external library: setuptools_, six_, babel_, click_
......@@ -136,9 +136,9 @@ Add below settings to sphinx document's conf.py if not exists::
Setup Makefile / make.bat
-------------------------
`make gettext` will generate pot files into `_build/locale` directory,
`make gettext` will generate pot files into `_build/gettext` directory,
however pot files should be generated in the `locale/pot` is convenient.
You can be done by replacing `_build/locale` with `locale/pot` in your
You can be done by replacing `_build/gettext` with `locale/pot` in your
`Makefile` and/or `make.bat` that was generated by sphinx-quickstart.
......
sphinx-intl (0.9.12-1) unstable; urgency=medium
* New upstream release 0.9.12
* debian/control
- drop python3.4 support as upstream did
- use dh12
- set Rules-Requires-Root: no
- set Standards-Version: 4.3.0
* debian/copyright
- update copyright year
* debian/gbp.conf
-- Hideki Yamane <henrich@debian.org> Fri, 17 May 2019 10:04:26 +0900
sphinx-intl (0.9.11-2) unstable; urgency=medium
* debian/patches
......
......@@ -3,15 +3,16 @@ Section: python
Priority: optional
Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Uploaders: Hideki Yamane <henrich@debian.org>
Build-Depends: debhelper (>= 11),
Build-Depends: debhelper (>= 12), debhelper-compat (= 12),
dh-python,
python3-all,
python3-setuptools,
Standards-Version: 4.1.3
Standards-Version: 4.3.0
Homepage: https://github.com/sphinx-doc/sphinx-intl
Vcs-Git: https://salsa.debian.org/python-team/modules/sphinx-intl.git
Vcs-Browser: https://salsa.debian.org/python-team/modules/sphinx-intl
X-Python3-Version: >= 3.4
X-Python3-Version: >= 3.5
Rules-Requires-Root: no
Package: sphinx-intl
Architecture: any
......
......@@ -3,7 +3,7 @@ Upstream-Name: sphinx-intl
Source: https://github.com/sphinx-doc/sphinx-intl/
Files: *
Copyright: 2013-2018 Takayuki SHIMIZUKAWA <shimizukawa@gmail.com>
Copyright: 2013-2019 Takayuki SHIMIZUKAWA <shimizukawa@gmail.com>
License: BSD-2-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -29,7 +29,7 @@ License: BSD-2-Clause
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Files: debian/*
Copyright: 2017-2018 Hideki Yamane <henrich@debian.org>
Copyright: 2017-2019 Hideki Yamane <henrich@debian.org>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
# Configuration file for "gbp <command>"
[DEFAULT]
# the default build command:
#builder = debuild -i -I
# the default clean command:
#cleaner = debuild clean
# the default branch for upstream sources:
upstream-branch = master
# the default branch for the debian patch:
debian-branch = debian/sid
# the default tag formats used:
upstream-tag = %(version)s
debian-tag = debian/%(version)s
#debian-tag-msg = %(pkg)s Debian release %(version)s
# use pristine-tar:
pristine-tar = True
# don't check if debian-branch == current branch:
ignore-branch = True
# Use color when on a terminal, alternatives: on/true, off/false or auto
color = auto
# Options only affecting gbp buildpackage
[buildpackage]
# Look for a tag matching the upstream version when creating a tarball
upstream-tree = tag
# uncomment this to automatically GPG sign tags:
sign-tags = True
# keyid to GPG sign tags with:
#keyid = 0xdeadbeef
# push to a remote repository after a successful tag:
#posttag = git-push git.example.com
# call lintian after a successful build:
#postbuild = lintian $GBP_CHANGES_FILE
# let package generate upstream changelog before build:
#prebuild = GIT_DIR=$GBP_GIT_DIR debian/autogen.sh
# use this for more svn-buildpackage like behaviour:
#export-dir = ../build-area/
#tarball-dir = ../tarballs/
#ignore-new = True
#export = HEAD
# compress with bzip2
compression = xz
# use best compression
#compression-level = best
# Don't send notifications, alternatives: on/true, off/false or auto
#notify = off
# Transparently handle submodules
# submodules = True
# Whether to use cowbuilder via git-pbuilder(1)
#pbuilder = True
# Which distribution to use with git-pbuilder
#dist = testing
# Options to pass to pbuilder when using git-pbuilder
#git-pbuilder-options = '--hookdir /etc/pbuilder/hooks'
# Options only affecting gbp import-orig
[import-orig]
# set a different upstream branch to import to:
#upstream-branch = newupstream
# set a different branch to merge to:
#debian-branch = dfsgclean
# don't merge to debian branch by default:
#merge = False
# import filter:
#filter = .svn
# filter out files from tarball passed to pristine tar:
#filter-pristine-tar = True
# run hook after the import:
#postimport = git-dch -N%(version)s -S -a --debian-branch=$GBP_BRANCH
# emulate old behaviour of calling dch:
#postimport = dch -v%(version)s New Upstream Version
# commit message:
#import-msg = New upstream version %(version)s
# Options only affecting gbp import-dsc
[import-dsc]
# set a different upstream branch:
#upstream-branch = svn-upstream
# import filter:
#filter = [ 'CVS', '.cvsignore' ]
#force committer to be the same as author
#author-is-committer = True
#same for the date
#author-date-is-committer-date = True
# Options only affecting gbp dch
[dch]
# options passed to git-log:
#git-log = --no-merges
# next snapshot number:
#snapshot-number = snapshot + 1
# include 7 digits of the commit id in the changelog enty:
#id-length = 7
# don't include information from meta tags:
#meta = False
# what tags to look for to generate bug-closing changelog entries:
#meta-closes = Closes|LP
# what regex should be used to parse the bug number
#meta-closes-bugnum = '(?:bug|issue)?\#?\s?\d+'
# include the full commit message in the changelog:
#full = True
# ignore Signed-off-by: lines:
#ignore-regex=(Signed-off|Acked)-by:
# use author name and email from git-config:
#git-author = True
# Customizatons can e.g. be used for line wrapping
#customizations=/usr/share/doc/git-buildpackage/examples/wrap_cl.py
# Options to pass to dch verbatim
#dch-opt = ['--mainttrailer']
# Options only affecting gbp pq
[pq]
#patch-numbers = False
# The format specifier for patch number prefixes
#patch-num-format = '%04d-'
# Whether to renumber patches when exporting patch queues
#renumber = False
# Whether to drop patch queue after export
#drop = False
# Options only affecting gbp clone
[clone]
#pristine-tar = True
# Options only affecting gbp pull
[pull]
#pristine-tar = True
# Options only affecting gbp create remote repo
[create-remote-repo]
# disable remote branch tracking
#track = False
# Sample config to create remote repositore using gbp create-remote-repo:
[remote-config pkg-libvirt]
# Location of the repository
remote-url-pattern = ssh://git.debian.org/git/pkg-libvirt/%(pkg)s
# Template dir to passed to git-init
template-dir = /srv/alioth.debian.org/chroot/home/groups/pkg-libvirt/git-template
......@@ -45,12 +45,11 @@ setup(
"Topic :: Utilities",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
author="Takayuki SHIMIZUKAWA",
author_email="shimizukawa@gmail.com",
......
# -*- coding: utf-8 -*-
__version__ = '0.9.11'
__version__ = '0.9.12'
......@@ -22,13 +22,14 @@ def get_lang_dirs(path):
# ==================================
# commands
def update(locale_dir, pot_dir, languages):
def update(locale_dir, pot_dir, languages, line_width=76):
"""
Update specified language's po files from pot.
:param unicode locale_dir: path for locale directory
:param unicode pot_dir: path for pot directory
:param tuple languages: languages to update po files
:param number line_width: maximum line wdith of po files
:return: {'create': 0, 'update': 0, 'notchanged': 0}
:rtype: dict
"""
......@@ -60,14 +61,14 @@ def update(locale_dir, pot_dir, languages):
status['update'] += 1
click.echo('Update: {0} +{1}, -{2}'.format(
po_file, len(added), len(deleted)))
c.dump_po(po_file, cat)
c.dump_po(po_file, cat, line_width)
else:
status['notchanged'] += 1
click.echo('Not Changed: {0}'.format(po_file))
else: # new po file
status['create'] += 1
click.echo('Create: {0}'.format(po_file))
c.dump_po(po_file, cat_pot)
c.dump_po(po_file, cat_pot, line_width)
return status
......
......@@ -23,11 +23,12 @@ def load_po(filename):
return pofile.read_po(f, charset=charset)
def dump_po(filename, catalog):
def dump_po(filename, catalog, line_width=76):
"""write po/pot file from catalog object
:param unicode filename: path to po file
:param catalog: catalog object
:param line_width: maximum line wdith of po files
:return: None
"""
dirname = os.path.dirname(filename)
......@@ -36,7 +37,7 @@ def dump_po(filename, catalog):
# Because babel automatically encode strings, file should be open as binary mode.
with io.open(filename, 'wb') as f:
pofile.write_po(f, catalog)
pofile.write_po(f, catalog, line_width)
def write_mo(filename, catalog):
......
......@@ -124,6 +124,14 @@ option_language = click.option(
multiple=True,
help="Target language to update po files. Default is ALL.")
option_line_width = click.option(
'-w', '--line-width',
envvar=ENVVAR_PREFIX + '_LINE_WIDTH',
type=int, default=76, metavar='<WIDTH>', show_default=True,
multiple=False,
help='The maximum line width for the po files, 0 or a negative number '
'disable line wrapping')
option_transifex_username = click.option(
'--transifex-username',
envvar=ENVVAR_PREFIX + '_TRANSIFEX_USERNAME',
......@@ -227,7 +235,8 @@ def main(ctx, config, tag):
@option_locale_dir
@option_pot_dir
@option_language
def update(locale_dir, pot_dir, language):
@option_line_width
def update(locale_dir, pot_dir, language, line_width):
"""
Update specified language's po files from pot.
......@@ -253,7 +262,7 @@ def update(locale_dir, pot_dir, language):
% locals())
raise click.BadParameter(msg, param_hint='language')
basic.update(locale_dir, pot_dir, languages)
basic.update(locale_dir, pot_dir, languages, line_width)
@main.command()
......
# -*- coding: utf-8 -*-
if False:
from typing import Iterator, List
# port from https://github.com/sphinx-doc/sphinx/blob/ad41e0b/sphinx/util/tags.py
class Tags(object):
def __init__(self, tags=None):
# type: (List[unicode]) -> None
# type: (List[str]) -> None
self.tags = dict.fromkeys(tags or [], True)
def has(self, tag):
# type: (unicode) -> bool
# type: (str) -> bool
return tag in self.tags
__contains__ = has
def __iter__(self):
# type: () -> Iterator[unicode]
# type: () -> Iterator[str]
return iter(self.tags)
def add(self, tag):
# type: (unicode) -> None
# type: (str) -> None
self.tags[tag] = True
def remove(self, tag):
# type: (unicode) -> None
# type: (str) -> None
self.tags.pop(tag, None)
......@@ -15,9 +15,12 @@ from .catalog import load_po
# To avoid using invalid resource name, append underscore to such names.
# As a limitation, append `_` doesn't care about collision to other resources.
# e.g. 'glossary' and 'glossary_' are pushed as a 'glossary_'.
# e.g. 'glossary' and 'glossary_' are pushed as a 'glossary_'. The following
# resource names are reserved slugs, Transifex will reply with an error on these
# resource names.
IGNORED_RESOURCE_NAMES = (
'glossary', # transifex reject this name
'glossary',
'settings',
)
TRANSIFEXRC_TEMPLATE = """\
......
......@@ -14,7 +14,7 @@ import pytest
from path import path
__dir__ = path(os.path.dirname(os.path.abspath(__file__)))
_dir = path(os.path.dirname(os.path.abspath(__file__)))
@pytest.fixture(scope="function")
......@@ -22,7 +22,7 @@ def temp(request, tmpdir):
template_dir = 'root'
tmpdir = path(tmpdir)
(__dir__ / template_dir).copytree(tmpdir / template_dir)
(_dir / template_dir).copytree(tmpdir / template_dir)
cwd = os.getcwd()
temp = tmpdir / template_dir
os.chdir(temp)
......
......@@ -127,6 +127,7 @@ def test_update_txconfig_resources_with_potfile_including_symbols(home_in_temp,
('spam-ham/egg.pot', 'spam-ham--egg_pot'),
('glossary', 'glossary_'),
('glossary_', 'glossary_'),
('settings', 'settings_'),
])
def test_normalize_resource_name(input, expected):
_callSUT = transifex.normalize_resource_name
......
[tox]
envlist=py36,py35,py34,py27,flake8,sdist
envlist=py37,py36,py35,py27,flake8,sdist
[testenv]
deps=-e.[transifex,test]
......