forked from xarg/django-stdimage
-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include compiled messages in dist packages (#208)
- Loading branch information
Showing
19 changed files
with
148 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- bandit | ||
- flake8 | ||
- isort | ||
- pydocstyle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,11 @@ build/ | |
dist/ | ||
.idea/ | ||
.tox/ | ||
coverage.xml | ||
|
||
|
||
.cache/ | ||
.coverage | ||
htmlcov/ | ||
|
||
.eggs/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include stdimage/locale/*/LC_MESSAGES/django.po | ||
include stdimage/locale/*/LC_MESSAGES/django.mo | ||
prune tests | ||
prune .github | ||
exclude .* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,56 @@ | ||
#!/usr/bin/env python | ||
import distutils | ||
import glob | ||
import os | ||
import subprocess # nosec | ||
from distutils.cmd import Command | ||
from distutils.command.build import build as _build | ||
|
||
from setuptools import setup | ||
from setuptools.command.install_lib import install_lib as _install_lib | ||
|
||
BASE_DIR = os.path.dirname((os.path.abspath(__file__))) | ||
|
||
|
||
class compile_translations(Command): | ||
description = 'Compile i18n translations using gettext.' | ||
user_options = [] | ||
|
||
def initialize_options(self): | ||
pass | ||
|
||
def finalize_options(self): | ||
pass | ||
|
||
def run(self): | ||
pattern = 'stdimage/locale/*/LC_MESSAGES/django.po' | ||
for file in glob.glob(pattern): | ||
cmd = ['msgfmt', '-c'] | ||
name, ext = os.path.splitext(file) | ||
|
||
cmd += ['-o', '%s.mo' % name] | ||
cmd += ['%s.po' % name] | ||
self.announce( | ||
'running command: %s' % ' '.join(cmd), | ||
level=distutils.log.INFO) | ||
subprocess.check_call(cmd, cwd=BASE_DIR) # nosec | ||
|
||
|
||
class build(_build): | ||
sub_commands = [('compile_translations', None)] + _build.sub_commands | ||
|
||
|
||
class install_lib(_install_lib): | ||
def run(self): | ||
self.run_command('compile_translations') | ||
_install_lib.run(self) | ||
|
||
|
||
setup( | ||
setup_requires=['pbr'], | ||
pbr=True, | ||
use_scm_version=True, | ||
cmdclass={ | ||
'build': build, | ||
'install_lib': install_lib, | ||
'compile_translations': compile_translations, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.