summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2017-10-20 15:19:16 +0000
committerGerrit Code Review <review@openstack.org>2017-10-20 15:19:16 +0000
commitee5a7ee09ef8ca67f7ca753ce92295861db49565 (patch)
tree691e691ddc9b7067b30a0edf9e79fa858b0e3511
parent062966e4a38a97c0e0c25128c40f39402706b2be (diff)
parent0445156611425f94bcdfba0bdac219f0c21a17f0 (diff)
Merge "rework tox.ini"
-rw-r--r--doc/source/conf.py14
-rw-r--r--doc/source/configuration/api.rst12
-rw-r--r--doc/source/configuration/metadata.rst2
-rw-r--r--doc/source/configuration/tables/ec2api-clients.inc (renamed from doc/source/configuration/tables/ec2api-clients.rst)0
-rw-r--r--doc/source/configuration/tables/ec2api-common.inc (renamed from doc/source/configuration/tables/ec2api-common.rst)0
-rw-r--r--doc/source/configuration/tables/ec2api-database.inc (renamed from doc/source/configuration/tables/ec2api-database.rst)0
-rw-r--r--doc/source/configuration/tables/ec2api-ec2.inc (renamed from doc/source/configuration/tables/ec2api-ec2.rst)0
-rw-r--r--doc/source/configuration/tables/ec2api-metadata.inc (renamed from doc/source/configuration/tables/ec2api-metadata.rst)0
-rw-r--r--doc/source/configuration/tables/ec2api-s3.inc (renamed from doc/source/configuration/tables/ec2api-s3.rst)0
-rw-r--r--doc/source/configuration/tables/ec2api-service.inc (renamed from doc/source/configuration/tables/ec2api-service.rst)0
-rw-r--r--test-requirements.txt1
-rwxr-xr-xtools/config/analyze_opts.py81
-rwxr-xr-xtools/enable-pre-commit-hook.sh42
-rw-r--r--tools/install_venv.py72
-rw-r--r--tools/install_venv_common.py211
-rw-r--r--tools/patch_tox_venv.py48
-rwxr-xr-xtools/tox_install.sh30
-rwxr-xr-xtools/with_venv.sh7
-rw-r--r--tox.ini66
19 files changed, 48 insertions, 538 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 403f1d1..99c4768 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -1,11 +1,9 @@
1 1
2from __future__ import print_function 2from __future__ import print_function
3 3
4import os
4import subprocess 5import subprocess
5import sys 6import sys
6import os
7import fileinput
8import fnmatch
9import warnings 7import warnings
10 8
11BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 9BASE_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -19,8 +17,8 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings'
19 17
20# -- General configuration ---------------------------------------------------- 18# -- General configuration ----------------------------------------------------
21 19
22# Add any Sphinx extension module names here, as strings. They can be extensions 20# Add any Sphinx extension module names here, as strings. They can be
23# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 21# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
24extensions = ['sphinx.ext.autodoc', 22extensions = ['sphinx.ext.autodoc',
25 'sphinx.ext.doctest', 23 'sphinx.ext.doctest',
26 'sphinx.ext.todo', 24 'sphinx.ext.todo',
@@ -63,9 +61,9 @@ pygments_style = 'sphinx'
63 61
64# The theme to use for HTML and HTML Help pages. Major themes that come with 62# The theme to use for HTML and HTML Help pages. Major themes that come with
65# Sphinx are currently 'default' and 'sphinxdoc'. 63# Sphinx are currently 'default' and 'sphinxdoc'.
66#html_theme_path = ["."] 64# html_theme_path = ["."]
67#html_theme = '_theme' 65# html_theme = '_theme'
68#html_static_path = ['static'] 66# html_static_path = ['static']
69html_theme = 'openstackdocs' 67html_theme = 'openstackdocs'
70 68
71html_last_updated_fmt = '%Y-%m-%d %H:%M' 69html_last_updated_fmt = '%Y-%m-%d %H:%M'
diff --git a/doc/source/configuration/api.rst b/doc/source/configuration/api.rst
index 8c30254..9cedb71 100644
--- a/doc/source/configuration/api.rst
+++ b/doc/source/configuration/api.rst
@@ -8,11 +8,11 @@ Configuration options
8The following options allow configuration that EC2API supports. 8The following options allow configuration that EC2API supports.
9 9
10 10
11.. include:: ./tables/ec2api-clients.rst 11.. include:: ./tables/ec2api-clients.inc
12.. include:: ./tables/ec2api-database.rst 12.. include:: ./tables/ec2api-database.inc
13.. include:: ./tables/ec2api-service.rst 13.. include:: ./tables/ec2api-service.inc
14.. include:: ./tables/ec2api-ec2.rst 14.. include:: ./tables/ec2api-ec2.inc
15.. include:: ./tables/ec2api-s3.rst 15.. include:: ./tables/ec2api-s3.inc
16.. include:: ./tables/ec2api-common.rst 16.. include:: ./tables/ec2api-common.inc
17 17
18 18
diff --git a/doc/source/configuration/metadata.rst b/doc/source/configuration/metadata.rst
index 9b8e9d5..93446c7 100644
--- a/doc/source/configuration/metadata.rst
+++ b/doc/source/configuration/metadata.rst
@@ -13,4 +13,4 @@ To configure Metadata Service for ec2api, EC2 API configuration_ common sections
13 13
14The additional configuration options for EC2 Metadata: 14The additional configuration options for EC2 Metadata:
15 15
16.. include:: ./tables/ec2api-metadata.rst 16.. include:: ./tables/ec2api-metadata.inc
diff --git a/doc/source/configuration/tables/ec2api-clients.rst b/doc/source/configuration/tables/ec2api-clients.inc
index d073f29..d073f29 100644
--- a/doc/source/configuration/tables/ec2api-clients.rst
+++ b/doc/source/configuration/tables/ec2api-clients.inc
diff --git a/doc/source/configuration/tables/ec2api-common.rst b/doc/source/configuration/tables/ec2api-common.inc
index 5f7cebb..5f7cebb 100644
--- a/doc/source/configuration/tables/ec2api-common.rst
+++ b/doc/source/configuration/tables/ec2api-common.inc
diff --git a/doc/source/configuration/tables/ec2api-database.rst b/doc/source/configuration/tables/ec2api-database.inc
index 7ec42b9..7ec42b9 100644
--- a/doc/source/configuration/tables/ec2api-database.rst
+++ b/doc/source/configuration/tables/ec2api-database.inc
diff --git a/doc/source/configuration/tables/ec2api-ec2.rst b/doc/source/configuration/tables/ec2api-ec2.inc
index 942bc7e..942bc7e 100644
--- a/doc/source/configuration/tables/ec2api-ec2.rst
+++ b/doc/source/configuration/tables/ec2api-ec2.inc
diff --git a/doc/source/configuration/tables/ec2api-metadata.rst b/doc/source/configuration/tables/ec2api-metadata.inc
index 58b04af..58b04af 100644
--- a/doc/source/configuration/tables/ec2api-metadata.rst
+++ b/doc/source/configuration/tables/ec2api-metadata.inc
diff --git a/doc/source/configuration/tables/ec2api-s3.rst b/doc/source/configuration/tables/ec2api-s3.inc
index 4bc4a35..4bc4a35 100644
--- a/doc/source/configuration/tables/ec2api-s3.rst
+++ b/doc/source/configuration/tables/ec2api-s3.inc
diff --git a/doc/source/configuration/tables/ec2api-service.rst b/doc/source/configuration/tables/ec2api-service.inc
index d9a6dfd..d9a6dfd 100644
--- a/doc/source/configuration/tables/ec2api-service.rst
+++ b/doc/source/configuration/tables/ec2api-service.inc
diff --git a/test-requirements.txt b/test-requirements.txt
index e88ddbc..75a222b 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -8,6 +8,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD
8mock>=2.0.0 # BSD 8mock>=2.0.0 # BSD
9nose>=1.3.7 # LGPL 9nose>=1.3.7 # LGPL
10oslotest>=1.10.0 # Apache-2.0 10oslotest>=1.10.0 # Apache-2.0
11os-testr>=1.0.0 # Apache-2.0
11pylint==1.4.5 # GPLv2 12pylint==1.4.5 # GPLv2
12python-subunit>=0.0.18 # Apache-2.0/BSD 13python-subunit>=0.0.18 # Apache-2.0/BSD
13sphinx>=1.6.2 # BSD 14sphinx>=1.6.2 # BSD
diff --git a/tools/config/analyze_opts.py b/tools/config/analyze_opts.py
deleted file mode 100755
index fd697cc..0000000
--- a/tools/config/analyze_opts.py
+++ /dev/null
@@ -1,81 +0,0 @@
1#!/usr/bin/env python
2# Copyright (c) 2012, Cloudscaling
3# All Rights Reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16'''
17find_unused_options.py
18
19Compare the ec2api.conf file with the ec2api.conf.sample file to find any
20unused options or default values in ec2api.conf
21'''
22
23from __future__ import print_function
24
25import argparse
26import os
27import sys
28
29from oslo_config import iniparser
30sys.path.append(os.getcwd())
31
32
33class PropertyCollecter(iniparser.BaseParser):
34 def __init__(self):
35 super(PropertyCollecter, self).__init__()
36 self.key_value_pairs = {}
37
38 def assignment(self, key, value):
39 self.key_value_pairs[key] = value
40
41 def new_section(self, section):
42 pass
43
44 @classmethod
45 def collect_properties(cls, lineiter, sample_format=False):
46 def clean_sample(f):
47 for line in f:
48 if line.startswith("#") and not line.startswith("# "):
49 line = line[1:]
50 yield line
51 pc = cls()
52 if sample_format:
53 lineiter = clean_sample(lineiter)
54 pc.parse(lineiter)
55 return pc.key_value_pairs
56
57
58if __name__ == '__main__':
59 parser = argparse.ArgumentParser(description='''Compare the ec2api.conf
60 file with the ec2api.conf.sample file to find any unused options or
61 default values in ec2api.conf''')
62
63 parser.add_argument('-c', action='store',
64 default='/etc/ec2api/ec2api.conf',
65 help='path to ec2api.conf\
66 (defaults to /etc/ec2api/ec2api.conf)')
67 parser.add_argument('-s', default='./etc/ec2api/ec2api.conf.sample',
68 help='path to ec2api.conf.sample\
69 (defaults to ./etc/ec2api/ec2api.conf.sample')
70 options = parser.parse_args()
71
72 conf_file_options = PropertyCollecter.collect_properties(open(options.c))
73 sample_conf_file_options = PropertyCollecter.collect_properties(
74 open(options.s), sample_format=True)
75
76 for k, v in sorted(conf_file_options.items()):
77 if k not in sample_conf_file_options:
78 print("Unused:", k)
79 for k, v in sorted(conf_file_options.items()):
80 if k in sample_conf_file_options and v == sample_conf_file_options[k]:
81 print("Default valued:", k)
diff --git a/tools/enable-pre-commit-hook.sh b/tools/enable-pre-commit-hook.sh
deleted file mode 100755
index d97c634..0000000
--- a/tools/enable-pre-commit-hook.sh
+++ /dev/null
@@ -1,42 +0,0 @@
1#!/bin/sh
2
3# Copyright 2011 OpenStack Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16
17PRE_COMMIT_SCRIPT=.git/hooks/pre-commit
18
19make_hook() {
20 echo "exec ./run_tests.sh -N -p" >> $PRE_COMMIT_SCRIPT
21 chmod +x $PRE_COMMIT_SCRIPT
22
23 if [ -w $PRE_COMMIT_SCRIPT -a -x $PRE_COMMIT_SCRIPT ]; then
24 echo "pre-commit hook was created successfully"
25 else
26 echo "unable to create pre-commit hook"
27 fi
28}
29
30# NOTE(jk0): Make sure we are in ec2-api's root directory before adding the hook.
31if [ ! -d ".git" ]; then
32 echo "unable to find .git; moving up a directory"
33 cd ..
34 if [ -d ".git" ]; then
35 make_hook
36 else
37 echo "still unable to find .git; hook not created"
38 fi
39else
40 make_hook
41fi
42
diff --git a/tools/install_venv.py b/tools/install_venv.py
deleted file mode 100644
index 0dcc57d..0000000
--- a/tools/install_venv.py
+++ /dev/null
@@ -1,72 +0,0 @@
1# Copyright 2010 United States Government as represented by the
2# Administrator of the National Aeronautics and Space Administration.
3# All Rights Reserved.
4#
5# Copyright 2010 OpenStack Foundation
6# Copyright 2013 IBM Corp.
7#
8# Licensed under the Apache License, Version 2.0 (the "License"); you may
9# not use this file except in compliance with the License. You may obtain
10# a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17# License for the specific language governing permissions and limitations
18# under the License.
19
20import os
21import sys
22
23import install_venv_common as install_venv
24
25
26def print_help(venv, root):
27 help = """
28 EC2 development environment setup is complete.
29
30 EC2 development uses virtualenv to track and manage Python dependencies
31 while in development and testing.
32
33 To activate the EC2 virtualenv for the extent of your current shell
34 session you can run:
35
36 $ source %s/bin/activate
37
38 Or, if you prefer, you can run commands in the virtualenv on a case by case
39 basis by running:
40
41 $ %s/tools/with_venv.sh <your command>
42
43 Also, make test will automatically use the virtualenv.
44 """
45 print help % (venv, root)
46
47
48def main(argv):
49 root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
50
51 if os.environ.get('tools_path'):
52 root = os.environ['tools_path']
53 venv = os.path.join(root, '.venv')
54 if os.environ.get('venv'):
55 venv = os.environ['venv']
56
57 pip_requires = os.path.join(root, 'requirements.txt')
58 test_requires = os.path.join(root, 'test-requirements.txt')
59 py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
60 project = 'ec2api'
61 install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
62 py_version, project)
63 options = install.parse_args(argv)
64 install.check_python_version()
65 install.check_dependencies()
66 install.create_virtualenv(no_site_packages=options.no_site_packages)
67 install.install_dependencies()
68 install.post_process()
69 print_help(venv, root)
70
71if __name__ == '__main__':
72 main(sys.argv)
diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py
deleted file mode 100644
index f14beac..0000000
--- a/tools/install_venv_common.py
+++ /dev/null
@@ -1,211 +0,0 @@
1# Copyright 2013 OpenStack Foundation
2# Copyright 2013 IBM Corp.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16"""Provides methods needed by installation script for OpenStack development
17virtual environments.
18
19Since this script is used to bootstrap a virtualenv from the system's Python
20environment, it should be kept strictly compatible with Python 2.6.
21
22Synced in from openstack-common
23"""
24
25from __future__ import print_function
26
27import optparse
28import os
29import subprocess
30import sys
31
32
33class InstallVenv(object):
34
35 def __init__(self, root, venv, requirements,
36 test_requirements, py_version,
37 project):
38 self.root = root
39 self.venv = venv
40 self.requirements = requirements
41 self.test_requirements = test_requirements
42 self.py_version = py_version
43 self.project = project
44
45 def die(self, message, *args):
46 print(message % args, file=sys.stderr)
47 sys.exit(1)
48
49 def check_python_version(self):
50 if sys.version_info < (2, 6):
51 self.die("Need Python Version >= 2.6")
52
53 def run_command_with_code(self, cmd, redirect_output=True,
54 check_exit_code=True):
55 """Runs a command in an out-of-process shell.
56
57 Returns the output of that command. Working directory is self.root.
58 """
59 if redirect_output:
60 stdout = subprocess.PIPE
61 else:
62 stdout = None
63
64 proc = subprocess.Popen(cmd, cwd=self.root, stdout=stdout)
65 output = proc.communicate()[0]
66 if check_exit_code and proc.returncode != 0:
67 self.die('Command "%s" failed.\n%s', ' '.join(cmd), output)
68 return (output, proc.returncode)
69
70 def run_command(self, cmd, redirect_output=True, check_exit_code=True):
71 return self.run_command_with_code(cmd, redirect_output,
72 check_exit_code)[0]
73
74 def get_distro(self):
75 if (os.path.exists('/etc/fedora-release') or
76 os.path.exists('/etc/redhat-release')):
77 return Fedora(
78 self.root, self.venv, self.requirements,
79 self.test_requirements, self.py_version, self.project)
80 else:
81 return Distro(
82 self.root, self.venv, self.requirements,
83 self.test_requirements, self.py_version, self.project)
84
85 def check_dependencies(self):
86 self.get_distro().install_virtualenv()
87
88 def create_virtualenv(self, no_site_packages=True):
89 """Creates the virtual environment and installs PIP.
90
91 Creates the virtual environment and installs PIP only into the
92 virtual environment.
93 """
94 if not os.path.isdir(self.venv):
95 print('Creating venv...', end=' ')
96 if no_site_packages:
97 self.run_command(['virtualenv', '-q', '--no-site-packages',
98 self.venv])
99 else:
100 self.run_command(['virtualenv', '-q', self.venv])
101 print('done.')
102 else:
103 print("venv already exists...")
104 pass
105
106 def pip_install(self, *args):
107 self.run_command(['tools/with_venv.sh',
108 'pip', 'install', '--upgrade'] + list(args),
109 redirect_output=False)
110
111 def install_dependencies(self):
112 print('Installing dependencies with pip (this can take a while)...')
113
114 # First things first, make sure our venv has the latest pip and
115 # setuptools and pbr
116 self.pip_install('pip>=1.4')
117 self.pip_install('setuptools')
118 self.pip_install('pbr')
119
120 self.pip_install('-r', self.requirements, '-r', self.test_requirements)
121
122 def post_process(self):
123 self.get_distro().post_process()
124
125 def parse_args(self, argv):
126 """Parses command-line arguments."""
127 parser = optparse.OptionParser()
128 parser.add_option('-n', '--no-site-packages',
129 action='store_true',
130 help="Do not inherit packages from global Python "
131 "install")
132 return parser.parse_args(argv[1:])[0]
133
134
135class Distro(InstallVenv):
136
137 def check_cmd(self, cmd):
138 return bool(self.run_command(['which', cmd],
139 check_exit_code=False).strip())
140
141 def install_virtualenv(self):
142 if self.check_cmd('virtualenv'):
143 return
144
145 if self.check_cmd('easy_install'):
146 print('Installing virtualenv via easy_install...', end=' ')
147 if self.run_command(['easy_install', 'virtualenv']):
148 print('Succeeded')
149 return
150 else:
151 print('Failed')
152
153 self.die('ERROR: virtualenv not found.\n\n%s development'
154 ' requires virtualenv, please install it using your'
155 ' favorite package management tool' % self.project)
156
157 def post_process(self):
158 """Any distribution-specific post-processing gets done here.
159
160 In particular, this is useful for applying patches to code inside
161 the venv.
162 """
163 pass
164
165
166class Fedora(Distro):
167 """This covers all Fedora-based distributions.
168
169 Includes: Fedora, RHEL, CentOS, Scientific Linux
170 """
171
172 def check_pkg(self, pkg):
173 return self.run_command_with_code(['rpm', '-q', pkg],
174 check_exit_code=False)[1] == 0
175
176 def apply_patch(self, originalfile, patchfile):
177 self.run_command(['patch', '-N', originalfile, patchfile],
178 check_exit_code=False)
179
180 def install_virtualenv(self):
181 if self.check_cmd('virtualenv'):
182 return
183
184 if not self.check_pkg('python-virtualenv'):
185 self.die("Please install 'python-virtualenv'.")
186
187 super(Fedora, self).install_virtualenv()
188
189 def post_process(self):
190 """Workaround for a bug in eventlet.
191
192 This currently affects RHEL6.1, but the fix can safely be
193 applied to all RHEL and Fedora distributions.
194
195 This can be removed when the fix is applied upstream.
196
197 EC2: https://bugs.launchpad.net/nova/+bug/884915
198 Upstream: https://bitbucket.org/eventlet/eventlet/issue/89
199 RHEL: https://bugzilla.redhat.com/958868
200 """
201
202 if os.path.exists('contrib/redhat-eventlet.patch'):
203 # Install "patch" program if it's not there
204 if not self.check_pkg('patch'):
205 self.die("Please install 'patch'.")
206
207 # Apply the eventlet patch
208 self.apply_patch(os.path.join(self.venv, 'lib', self.py_version,
209 'site-packages',
210 'eventlet/green/subprocess.py'),
211 'contrib/redhat-eventlet.patch')
diff --git a/tools/patch_tox_venv.py b/tools/patch_tox_venv.py
deleted file mode 100644
index 3a9fa2b..0000000
--- a/tools/patch_tox_venv.py
+++ /dev/null
@@ -1,48 +0,0 @@
1# Copyright 2013 Red Hat, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import os
16import sys
17
18import install_venv_common as install_venv # noqa
19
20
21def first_file(file_list):
22 for candidate in file_list:
23 if os.path.exists(candidate):
24 return candidate
25
26
27def main(argv):
28 root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
29
30 venv = os.environ['VIRTUAL_ENV']
31
32 pip_requires = first_file([
33 os.path.join(root, 'requirements.txt'),
34 os.path.join(root, 'tools', 'pip-requires'),
35 ])
36 test_requires = first_file([
37 os.path.join(root, 'test-requirements.txt'),
38 os.path.join(root, 'tools', 'test-requires'),
39 ])
40 py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
41 project = 'ec2api'
42 install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
43 py_version, project)
44 #NOTE(dprince): For Tox we only run post_process (which patches files, etc)
45 install.post_process()
46
47if __name__ == '__main__':
48 main(sys.argv)
diff --git a/tools/tox_install.sh b/tools/tox_install.sh
deleted file mode 100755
index e61b63a..0000000
--- a/tools/tox_install.sh
+++ /dev/null
@@ -1,30 +0,0 @@
1#!/usr/bin/env bash
2
3# Client constraint file contains this client version pin that is in conflict
4# with installing the client from source. We should remove the version pin in
5# the constraints file before applying it for from-source installation.
6
7CONSTRAINTS_FILE="$1"
8shift 1
9
10set -e
11
12# NOTE(tonyb): Place this in the tox enviroment's log dir so it will get
13# published to logs.openstack.org for easy debugging.
14localfile="$VIRTUAL_ENV/log/upper-constraints.txt"
15
16if [[ "$CONSTRAINTS_FILE" != http* ]]; then
17 CONSTRAINTS_FILE="file://$CONSTRAINTS_FILE"
18fi
19# NOTE(tonyb): need to add curl to bindep.txt if the project supports bindep
20curl "$CONSTRAINTS_FILE" --insecure --progress-bar --output "$localfile"
21
22pip install -c"$localfile" openstack-requirements
23
24# This is the main purpose of the script: Allow local installation of
25# the current repo. It is listed in constraints file and thus any
26# install will be constrained and we need to unconstrain it.
27edit-constraints "$localfile" -- "$CLIENT_NAME"
28
29pip install -c"$localfile" -U "$@"
30exit $?
diff --git a/tools/with_venv.sh b/tools/with_venv.sh
deleted file mode 100755
index 94e05c1..0000000
--- a/tools/with_venv.sh
+++ /dev/null
@@ -1,7 +0,0 @@
1#!/bin/bash
2tools_path=${tools_path:-$(dirname $0)}
3venv_path=${venv_path:-${tools_path}}
4venv_dir=${venv_name:-/../.venv}
5TOOLS=${tools_path}
6VENV=${venv:-${venv_path}/${venv_dir}}
7source ${VENV}/bin/activate && "$@"
diff --git a/tox.ini b/tox.ini
index 9ea1d08..ac5ba08 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,50 +1,59 @@
1[tox] 1[tox]
2minversion = 2.0 2minversion = 2.1
3envlist = py35,py27,pep8 3envlist = py{35,27},pep8,docs,api-ref
4skipsdist = True 4skipsdist = True
5 5
6[testenv] 6[testenv]
7sitepackages = False
8usedevelop = True 7usedevelop = True
9install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} 8# tox is silly... these need to be separated by a newline....
9whitelist_externals = bash
10 find
11 rm
12 env
13install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
10setenv = VIRTUAL_ENV={envdir} 14setenv = VIRTUAL_ENV={envdir}
11 BRANCH_NAME=master
12 CLIENT_NAME=ec2-api
13 LANG=en_US.UTF-8 15 LANG=en_US.UTF-8
14 LANGUAGE=en_US:en 16 LANGUAGE=en_US:en
15 LC_ALL=C 17 LC_ALL=C
16deps = -r{toxinidir}/requirements.txt 18deps = -r{toxinidir}/test-requirements.txt
17 -r{toxinidir}/test-requirements.txt
18commands = 19commands =
20 find . -type f -name "*.pyc" -delete
19 rm -f .testrepository/times.dbm 21 rm -f .testrepository/times.dbm
20 python tools/patch_tox_venv.py
21 python setup.py testr --slowest --testr-args='{posargs}'
22whitelist_externals =
23 rm
24 22
25[tox:jenkins] 23[testenv:py27]
26sitepackages = False 24commands =
25 {[testenv]commands}
26 stestr --test-path 'ec2api/tests/unit' run '{posargs}'
27 stestr slowest
28
29[testenv:py35]
30commands =
31 {[testenv]commands}
32 stestr --test-path 'ec2api/tests/unit' run '{posargs}'
33 stestr slowest
27 34
28[testenv:pep8] 35[testenv:pep8]
29sitepackages = False
30commands = 36commands =
31 flake8 {posargs} 37 flake8 {posargs}
32 38
33[testenv:genconfig] 39[testenv:genconfig]
34commands = oslo-config-generator --config-file=etc/ec2api/ec2api-config-generator.conf 40commands = oslo-config-generator --config-file=etc/ec2api/ec2api-config-generator.conf
35 41
36[testenv:cover]
37# Also do not run test_coverage_ext tests while gathering coverage as those
38# tests conflict with coverage.
39commands =
40 coverage erase
41 python setup.py test --coverage --testr-args='{posargs}'
42 coverage combine
43 coverage html --include='ec2api/*' --omit='ec2api/tests/*' -d covhtml -i
44
45[testenv:venv] 42[testenv:venv]
46commands = {posargs} 43commands = {posargs}
47 44
45[testenv:docs]
46# This environment is called from CI scripts to test and publish
47# the API Ref and Docs to developer.openstack.org.
48commands = python setup.py build_sphinx
49
50[testenv:api-ref]
51# This environment is called from CI scripts to test and publish
52# the API Ref to developer.openstack.org.
53commands =
54 rm -rf api-ref/build
55 sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
56
48[flake8] 57[flake8]
49# E712 is ignored on purpose, since it is normal to use 'column == true' 58# E712 is ignored on purpose, since it is normal to use 'column == true'
50# in sqlalchemy. 59# in sqlalchemy.
@@ -55,15 +64,8 @@ ignore = E121,E122,E123,E124,E126,E127,E128,E711,E712,H102,H303,H404,F403,F811,F
55# H106: Don’t put vim configuration in source files 64# H106: Don’t put vim configuration in source files
56# H203: Use assertIs(Not)None to check for None 65# H203: Use assertIs(Not)None to check for None
57enable-extensions=H106,H203 66enable-extensions=H106,H203
58exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,ec2api/tests/functional/obsolete 67exclude = .venv,.git,.tox,dist,envname,*lib/python*,*egg,build,tools,ec2api/tests/functional/obsolete
59max-complexity=25 68max-complexity=25
60 69
61[hacking] 70[hacking]
62local-check-factory = ec2api.hacking.checks.factory 71local-check-factory = ec2api.hacking.checks.factory
63
64[testenv:api-ref]
65# This environment is called from CI scripts to test and publish
66# the API Ref to developer.openstack.org.
67commands =
68 rm -rf api-ref/build
69 sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html