
- Updated tox envlist, so just running `tox` from the CLI will now run all voting gate tests - Reduce duplicated definitions and commands - Remove any reliance on run_tests within tox - Removes all doc references to run_tests.sh, and replaces them with their tox equivalent. Where necessary, language around the tox commands has been altered or extended so that it makes sense and is consistent with other parts of the docs. Also adds a new "Test Environment" list to the docs, so that newcomers do not have to piece together CLI commands and their cryptic extensions from tox.ini - Move the inline shell scripting to its own file. Also fixes a bug when passing args, since the logic assumed you were attempting a subset test run (try `tox -e py27 -- --pdb` on master to compare) - Moved translation tooling from run_tests to manage.py, w/ help text and arg restrictions. This is much more flexible so that plugins can use it without having to copy commands, but still defaults to exactly the same parameters/behaviour from run_tests. Docs updated appropriately. - Removed npm/karma strange reliance on either .venv or tox/py27. Now it only uses tox/npm. Change-Id: I883f885bd424955d39ddcfde5ba396a88cfc041e Implements: blueprint enhance-tox Closes-Bug: 1638672
58 lines
2.4 KiB
Python
58 lines
2.4 KiB
Python
# Copyright 2016 Cisco Systems, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from distutils.dist import Distribution
|
|
import os
|
|
from subprocess import call
|
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = ('Extract strings that have been marked for translation into .POT '
|
|
'files.')
|
|
|
|
def add_arguments(self, parser):
|
|
parser.add_argument('-m', '--module', type=str, nargs='+',
|
|
default=['openstack_dashboard', 'horizon'],
|
|
help=("The target python module(s) to extract "
|
|
"strings from"))
|
|
parser.add_argument('-d', '--domain', choices=['django', 'djangojs'],
|
|
nargs='+', default=['django', 'djangojs'],
|
|
help="Domain(s) of the .pot file")
|
|
parser.add_argument('--check-only', action='store_true',
|
|
help=("Checks that extraction works correctly, "
|
|
"then deletes the .pot file to avoid "
|
|
"polluting the source code"))
|
|
|
|
def handle(self, *args, **options):
|
|
cmd = ('python setup.py extract_messages -F babel-{domain}.cfg '
|
|
'-o {module}/locale/{domain}.pot')
|
|
distribution = Distribution()
|
|
distribution.parse_config_files(distribution.find_config_files())
|
|
|
|
if options['check_only']:
|
|
cmd += " ; rm {module}/locale/{domain}.pot"
|
|
|
|
for module in options['module']:
|
|
for domain in options['domain']:
|
|
potfile = '{module}/locale/{domain}.pot'.format(module=module,
|
|
domain=domain)
|
|
if not os.path.exists(potfile):
|
|
with open(potfile, 'wb') as f:
|
|
f.write(b'')
|
|
|
|
call(cmd.format(module=module, domain=domain, potfile=potfile),
|
|
shell=True)
|