Skip to content

Commit 0a0ef12

Browse files
committed
Adopt black style
Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent e5833d1 commit 0a0ef12

17 files changed

+930
-741
lines changed

docs/source/conf.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,20 @@
1717

1818
# -- Project information -----------------------------------------------------
1919

20-
project = 'nexb-skeleton'
21-
copyright = 'nexb Inc.'
22-
author = 'nexb Inc.'
20+
project = "nexb-skeleton"
21+
copyright = "nexb Inc."
22+
author = "nexb Inc."
2323

2424

2525
# -- General configuration ---------------------------------------------------
2626

2727
# Add any Sphinx extension module names here, as strings. They can be
2828
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2929
# ones.
30-
extensions = [
31-
]
30+
extensions = []
3231

3332
# Add any paths that contain templates here, relative to this directory.
34-
templates_path = ['_templates']
33+
templates_path = ["_templates"]
3534

3635
# List of patterns, relative to source directory, that match files and
3736
# directories to ignore when looking for source files.
@@ -44,20 +43,20 @@
4443
# The theme to use for HTML and HTML Help pages. See the documentation for
4544
# a list of builtin themes.
4645
#
47-
html_theme = 'sphinx_rtd_theme'
46+
html_theme = "sphinx_rtd_theme"
4847

4948
# Add any paths that contain custom static files (such as style sheets) here,
5049
# relative to this directory. They are copied after the builtin static files,
5150
# so a file named "default.css" will overwrite the builtin "default.css".
52-
html_static_path = ['_static']
51+
html_static_path = ["_static"]
5352

5453
html_context = {
55-
'css_files': [
56-
'_static/theme_overrides.css', # override wide tables in RTD theme
57-
],
54+
"css_files": [
55+
"_static/theme_overrides.css", # override wide tables in RTD theme
56+
],
5857
"display_github": True,
5958
"github_user": "nexB",
6059
"github_repo": "nexb-skeleton",
6160
"github_version": "develop", # branch
6261
"conf_py_path": "/docs/source/", # path in the checkout to the docs root
63-
}
62+
}

etc/scripts/bootstrap.py

Lines changed: 77 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,63 @@
1919

2020

2121
@click.command()
22-
23-
@click.option('-r', '--requirements-file',
22+
@click.option(
23+
"-r",
24+
"--requirements-file",
2425
type=click.Path(exists=True, readable=True, path_type=str, dir_okay=False),
25-
metavar='FILE',
26+
metavar="FILE",
2627
multiple=True,
27-
default=['requirements.txt'],
28+
default=["requirements.txt"],
2829
show_default=True,
29-
help='Path to the requirements file(s) to use for thirdparty packages.',
30+
help="Path to the requirements file(s) to use for thirdparty packages.",
3031
)
31-
@click.option('-d', '--thirdparty-dir',
32+
@click.option(
33+
"-d",
34+
"--thirdparty-dir",
3235
type=click.Path(exists=True, readable=True, path_type=str, file_okay=False),
33-
metavar='DIR',
36+
metavar="DIR",
3437
default=utils_thirdparty.THIRDPARTY_DIR,
3538
show_default=True,
36-
help='Path to the thirdparty directory where wheels are built and '
37-
'sources, ABOUT and LICENSE files fetched.',
39+
help="Path to the thirdparty directory where wheels are built and "
40+
"sources, ABOUT and LICENSE files fetched.",
3841
)
39-
@click.option('-p', '--python-version',
42+
@click.option(
43+
"-p",
44+
"--python-version",
4045
type=click.Choice(utils_thirdparty.PYTHON_VERSIONS),
41-
metavar='PYVER',
46+
metavar="PYVER",
4247
default=utils_thirdparty.PYTHON_VERSIONS,
4348
show_default=True,
4449
multiple=True,
45-
help='Python version(s) to use for this build.',
50+
help="Python version(s) to use for this build.",
4651
)
47-
@click.option('-o', '--operating-system',
52+
@click.option(
53+
"-o",
54+
"--operating-system",
4855
type=click.Choice(utils_thirdparty.PLATFORMS_BY_OS),
49-
metavar='OS',
56+
metavar="OS",
5057
default=tuple(utils_thirdparty.PLATFORMS_BY_OS),
5158
multiple=True,
5259
show_default=True,
53-
help='OS(ses) to use for this build: one of linux, mac or windows.',
60+
help="OS(ses) to use for this build: one of linux, mac or windows.",
5461
)
55-
@click.option('-l', '--latest-version',
62+
@click.option(
63+
"-l",
64+
"--latest-version",
5665
is_flag=True,
57-
help='Get the latest version of all packages, ignoring version specifiers.',
66+
help="Get the latest version of all packages, ignoring version specifiers.",
5867
)
59-
@click.option('--sync-dejacode',
68+
@click.option(
69+
"--sync-dejacode",
6070
is_flag=True,
61-
help='Synchronize packages with DejaCode.',
71+
help="Synchronize packages with DejaCode.",
6272
)
63-
@click.option('--with-deps',
73+
@click.option(
74+
"--with-deps",
6475
is_flag=True,
65-
help='Also include all dependent wheels.',
76+
help="Also include all dependent wheels.",
6677
)
67-
@click.help_option('-h', '--help')
78+
@click.help_option("-h", "--help")
6879
def bootstrap(
6980
requirements_file,
7081
thirdparty_dir,
@@ -105,18 +116,19 @@ def bootstrap(
105116
required_name_versions = set()
106117

107118
for req_file in requirements_files:
108-
nvs = utils_thirdparty.load_requirements(
109-
requirements_file=req_file, force_pinned=False)
119+
nvs = utils_thirdparty.load_requirements(requirements_file=req_file, force_pinned=False)
110120
required_name_versions.update(nvs)
111121
if latest_version:
112122
required_name_versions = set((name, None) for name, _ver in required_name_versions)
113123

114-
print(f'PROCESSING {len(required_name_versions)} REQUIREMENTS in {len(requirements_files)} FILES')
124+
print(
125+
f"PROCESSING {len(required_name_versions)} REQUIREMENTS in {len(requirements_files)} FILES"
126+
)
115127

116128
# fetch all available wheels, keep track of missing
117129
# start with local, then remote, then PyPI
118130

119-
print('==> COLLECTING ALREADY LOCALLY AVAILABLE REQUIRED WHEELS')
131+
print("==> COLLECTING ALREADY LOCALLY AVAILABLE REQUIRED WHEELS")
120132
# list of all the wheel filenames either pre-existing, fetched or built
121133
# updated as we progress
122134
available_wheel_filenames = []
@@ -131,19 +143,32 @@ def bootstrap(
131143

132144
# start with a local check
133145
for (name, version), envt in itertools.product(required_name_versions, environments):
134-
local_pack = local_packages_by_namever.get((name, version,))
146+
local_pack = local_packages_by_namever.get(
147+
(
148+
name,
149+
version,
150+
)
151+
)
135152
if local_pack:
136153
supported_wheels = list(local_pack.get_supported_wheels(environment=envt))
137154
if supported_wheels:
138155
available_wheel_filenames.extend(w.filename for w in supported_wheels)
139-
print(f'====> No fetch or build needed. '
140-
f'Local wheel already available for {name}=={version} '
141-
f'on os: {envt.operating_system} for Python: {envt.python_version}')
156+
print(
157+
f"====> No fetch or build needed. "
158+
f"Local wheel already available for {name}=={version} "
159+
f"on os: {envt.operating_system} for Python: {envt.python_version}"
160+
)
142161
continue
143162

144-
name_version_envt_to_fetch.append((name, version, envt,))
163+
name_version_envt_to_fetch.append(
164+
(
165+
name,
166+
version,
167+
envt,
168+
)
169+
)
145170

146-
print(f'==> TRYING TO FETCH #{len(name_version_envt_to_fetch)} REQUIRED WHEELS')
171+
print(f"==> TRYING TO FETCH #{len(name_version_envt_to_fetch)} REQUIRED WHEELS")
147172

148173
# list of (name, version, environment) not fetch and to build
149174
name_version_envt_to_build = []
@@ -161,52 +186,59 @@ def bootstrap(
161186
if fetched_fwn:
162187
available_wheel_filenames.append(fetched_fwn)
163188
else:
164-
name_version_envt_to_build.append((name, version, envt,))
189+
name_version_envt_to_build.append(
190+
(
191+
name,
192+
version,
193+
envt,
194+
)
195+
)
165196

166197
# At this stage we have all the wheels we could obtain without building
167198
for name, version, envt in name_version_envt_to_build:
168-
print(f'====> Need to build wheels for {name}=={version} on os: '
169-
f'{envt.operating_system} for Python: {envt.python_version}')
199+
print(
200+
f"====> Need to build wheels for {name}=={version} on os: "
201+
f"{envt.operating_system} for Python: {envt.python_version}"
202+
)
170203

171204
packages_and_envts_to_build = [
172-
(PypiPackage(name, version), envt)
173-
for name, version, envt in name_version_envt_to_build
205+
(PypiPackage(name, version), envt) for name, version, envt in name_version_envt_to_build
174206
]
175207

176-
print(f'==> BUILDING #{len(packages_and_envts_to_build)} MISSING WHEELS')
208+
print(f"==> BUILDING #{len(packages_and_envts_to_build)} MISSING WHEELS")
177209

178210
package_envts_not_built, wheel_filenames_built = utils_thirdparty.build_missing_wheels(
179211
packages_and_envts=packages_and_envts_to_build,
180212
build_remotely=build_remotely,
181213
with_deps=with_deps,
182214
dest_dir=thirdparty_dir,
183-
)
215+
)
184216
if wheel_filenames_built:
185217
available_wheel_filenames.extend(available_wheel_filenames)
186218

187219
for pack, envt in package_envts_not_built:
188220
print(
189-
f'====> FAILED to build any wheel for {pack.name}=={pack.version} '
190-
f'on os: {envt.operating_system} for Python: {envt.python_version}'
221+
f"====> FAILED to build any wheel for {pack.name}=={pack.version} "
222+
f"on os: {envt.operating_system} for Python: {envt.python_version}"
191223
)
192224

193-
print(f'==> FETCHING SOURCE DISTRIBUTIONS')
225+
print(f"==> FETCHING SOURCE DISTRIBUTIONS")
194226
# fetch all sources, keep track of missing
195227
# This is a list of (name, version)
196228
utils_thirdparty.fetch_missing_sources(dest_dir=thirdparty_dir)
197229

198-
print(f'==> FETCHING ABOUT AND LICENSE FILES')
230+
print(f"==> FETCHING ABOUT AND LICENSE FILES")
199231
utils_thirdparty.add_fetch_or_update_about_and_license_files(dest_dir=thirdparty_dir)
200232

201233
############################################################################
202234
if sync_dejacode:
203-
print(f'==> SYNC WITH DEJACODE')
235+
print(f"==> SYNC WITH DEJACODE")
204236
# try to fetch from DejaCode any missing ABOUT
205237
# create all missing DejaCode packages
206238
pass
207239

208240
utils_thirdparty.find_problems(dest_dir=thirdparty_dir)
209241

210242

211-
if __name__ == '__main__':
243+
if __name__ == "__main__":
212244
bootstrap()

etc/scripts/build_wheels.py

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,67 @@
1414

1515

1616
@click.command()
17-
18-
@click.option('-n', '--name',
17+
@click.option(
18+
"-n",
19+
"--name",
1920
type=str,
20-
metavar='PACKAGE_NAME',
21+
metavar="PACKAGE_NAME",
2122
required=True,
22-
help='Python package name to add or build.',
23+
help="Python package name to add or build.",
2324
)
24-
@click.option('-v', '--version',
25+
@click.option(
26+
"-v",
27+
"--version",
2528
type=str,
2629
default=None,
27-
metavar='VERSION',
28-
help='Python package version to add or build.',
30+
metavar="VERSION",
31+
help="Python package version to add or build.",
2932
)
30-
@click.option('-d', '--thirdparty-dir',
33+
@click.option(
34+
"-d",
35+
"--thirdparty-dir",
3136
type=click.Path(exists=True, readable=True, path_type=str, file_okay=False),
32-
metavar='DIR',
37+
metavar="DIR",
3338
default=utils_thirdparty.THIRDPARTY_DIR,
3439
show_default=True,
35-
help='Path to the thirdparty directory where wheels are built.',
40+
help="Path to the thirdparty directory where wheels are built.",
3641
)
37-
@click.option('-p', '--python-version',
42+
@click.option(
43+
"-p",
44+
"--python-version",
3845
type=click.Choice(utils_thirdparty.PYTHON_VERSIONS),
39-
metavar='PYVER',
46+
metavar="PYVER",
4047
default=utils_thirdparty.PYTHON_VERSIONS,
4148
show_default=True,
4249
multiple=True,
43-
help='Python version to use for this build.',
50+
help="Python version to use for this build.",
4451
)
45-
@click.option('-o', '--operating-system',
52+
@click.option(
53+
"-o",
54+
"--operating-system",
4655
type=click.Choice(utils_thirdparty.PLATFORMS_BY_OS),
47-
metavar='OS',
56+
metavar="OS",
4857
default=tuple(utils_thirdparty.PLATFORMS_BY_OS),
4958
multiple=True,
5059
show_default=True,
51-
help='OS to use for this build: one of linux, mac or windows.',
60+
help="OS to use for this build: one of linux, mac or windows.",
5261
)
53-
@click.option('--build-remotely',
62+
@click.option(
63+
"--build-remotely",
5464
is_flag=True,
55-
help='Build missing wheels remotely.',
65+
help="Build missing wheels remotely.",
5666
)
57-
@click.option('--with-deps',
67+
@click.option(
68+
"--with-deps",
5869
is_flag=True,
59-
help='Also include all dependent wheels.',
70+
help="Also include all dependent wheels.",
6071
)
61-
@click.option('--verbose',
72+
@click.option(
73+
"--verbose",
6274
is_flag=True,
63-
help='Provide verbose output.',
75+
help="Provide verbose output.",
6476
)
65-
@click.help_option('-h', '--help')
77+
@click.help_option("-h", "--help")
6678
def build_wheels(
6779
name,
6880
version,
@@ -93,5 +105,5 @@ def build_wheels(
93105
)
94106

95107

96-
if __name__ == '__main__':
108+
if __name__ == "__main__":
97109
build_wheels()

0 commit comments

Comments
 (0)