diff --git a/etc/scripts/fix_thirdparty.py b/etc/scripts/fix_thirdparty.py index 9d401cd1..d664c9c4 100644 --- a/etc/scripts/fix_thirdparty.py +++ b/etc/scripts/fix_thirdparty.py @@ -78,7 +78,7 @@ def fix_thirdparty_dir( package_envts_not_fetched = utils_thirdparty.fetch_missing_wheels(dest_dir=thirdparty_dir) print("***FETCH*** MISSING SOURCES") src_name_ver_not_fetched = utils_thirdparty.fetch_missing_sources(dest_dir=thirdparty_dir) - + package_envts_not_built = [] if build_wheels: print("***BUILD*** MISSING WHEELS") @@ -89,7 +89,7 @@ def fix_thirdparty_dir( dest_dir=thirdparty_dir, ) package_envts_not_built, _wheel_filenames_built = results - + print("***ADD*** ABOUT AND LICENSES") utils_thirdparty.add_fetch_or_update_about_and_license_files( dest_dir=thirdparty_dir, @@ -99,7 +99,7 @@ def fix_thirdparty_dir( # report issues for name, version in src_name_ver_not_fetched: print(f"{name}=={version}: Failed to fetch source distribution.") - + for package, envt in package_envts_not_built: print( f"{package.name}=={package.version}: Failed to build wheel " diff --git a/etc/scripts/utils_requirements.py b/etc/scripts/utils_requirements.py index fc331f65..7753ea02 100644 --- a/etc/scripts/utils_requirements.py +++ b/etc/scripts/utils_requirements.py @@ -86,7 +86,7 @@ def has_ops(l): return any(op in l for op in ops) if not has_ops: - return line + return line splitter = re.compile(r"[>= 6, != 7.0.0 pytest-xdist >= 2 + black docs= Sphinx>=3.3.1 sphinx-rtd-theme>=0.5.0 diff --git a/tests/test_skeleton_codestyle.py b/tests/test_skeleton_codestyle.py new file mode 100644 index 00000000..2eb6e558 --- /dev/null +++ b/tests/test_skeleton_codestyle.py @@ -0,0 +1,36 @@ +# +# Copyright (c) nexB Inc. and others. All rights reserved. +# ScanCode is a trademark of nexB Inc. +# SPDX-License-Identifier: Apache-2.0 +# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. +# See https://github.com/nexB/skeleton for support or download. +# See https://aboutcode.org for more information about nexB OSS projects. +# + +import subprocess +import unittest +import configparser + + +class BaseTests(unittest.TestCase): + def test_skeleton_codestyle(self): + """ + This test shouldn't run in proliferated repositories. + """ + setup_cfg = configparser.ConfigParser() + setup_cfg.read("setup.cfg") + if setup_cfg["metadata"]["name"] != "skeleton": + return + + args = "venv/bin/black --check -l 100 setup.py etc tests" + try: + subprocess.check_output(args.split()) + except subprocess.CalledProcessError as e: + print("===========================================================") + print(e.output) + print("===========================================================") + raise Exception( + "Black style check failed; please format the code using:\n" + " python -m black -l 100 setup.py etc tests", + e.output, + ) from e