forked from pypa/sample-namespace-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
100 lines (83 loc) · 3.43 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Copyright 2017 Google 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.
import os
import nox
HERE = os.path.abspath(os.path.dirname(__file__))
# -- REQUIRES: nox >= 2018.10.17
# SEE: https://nox.readthedocs.io/en/stable/index.html
USE_PYTHON_VERSIONS_DEFAULT = ["2.7", "3.7"]
USE_PYTHON_VERSIONS = os.environ.get("NOXFILE_PYTHON_VERSIONS", "").split()
if not USE_PYTHON_VERSIONS:
USE_PYTHON_VERSIONS = USE_PYTHON_VERSIONS_DEFAULT
install_commands = (
('pip', 'install', '.'),
('pip', 'install', '-e', '.'),
('python', 'setup.py', 'install'),
('python', 'setup.py', 'develop'))
def install_packages(session, package_a, package_b, command_a, command_b):
session.chdir(package_a)
session.run('rm', '-rf', 'dist', 'build', '*.egg-info')
session.run(*command_a)
session.chdir(HERE)
session.chdir(package_b)
session.run('rm', '-rf', 'dist', 'build', '*.egg-info')
session.run(*command_b)
session.chdir(HERE)
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
def session_pkgutil(session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'pkgutil/pkg_a', 'pkgutil/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
def session_pkg_resources(session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'pkg_resources/pkg_a', 'pkg_resources/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
def session_pep420(session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'native/pkg_a', 'native/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
def session_cross_pkg_resources_pkgutil(
session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'pkg_resources/pkg_a', 'pkgutil/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
def session_cross_pep420_pkgutil(
session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'native/pkg_a', 'pkgutil/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')