diff --git a/.github/workflows/scancode-release.yml b/.github/workflows/scancode-release.yml index 440e38482a3..e90e924a534 100644 --- a/.github/workflows/scancode-release.yml +++ b/.github/workflows/scancode-release.yml @@ -153,16 +153,16 @@ jobs: rm -rf thirdparty build dist rm -rf .eggs src/scancode_toolkit.egg-info src/scancode_toolkit_mini.egg-info mkdir -p thirdparty + venv/bin/python etc/scripts/fetch_thirdparty.py \ + --requirements=requirements-native.txt \ + --dest=thirdparty \ + --sdists venv/bin/python etc/scripts/fetch_thirdparty.py \ --requirements=requirements.txt \ --dest=thirdparty \ --python-version=$python_version \ --operating-system=$operating_system \ --wheels - venv/bin/python etc/scripts/fetch_thirdparty.py \ - --requirements=requirements-native.txt \ - --dest=thirdparty \ - --sdists venv/bin/python setup.py --quiet sdist --formats=$formats venv/bin/python etc/release/scancode_rename_archives.py dist/ _py$python_version-$operating_system @@ -208,16 +208,16 @@ jobs: rm -rf thirdparty build dist rm -rf .eggs src/scancode_toolkit.egg-info src/scancode_toolkit_mini.egg-info mkdir -p thirdparty + venv/bin/python etc/scripts/fetch_thirdparty.py \ + --requirements=requirements-native.txt \ + --dest=thirdparty \ + --sdists venv/bin/python etc/scripts/fetch_thirdparty.py \ --requirements=requirements.txt \ --dest=thirdparty \ --python-version=$python_version \ --operating-system=$operating_system \ --wheels - venv/bin/python etc/scripts/fetch_thirdparty.py \ - --requirements=requirements-native.txt \ - --dest=thirdparty \ - --sdists venv/bin/python setup.py --quiet sdist --formats=$formats venv/bin/python etc/release/scancode_rename_archives.py dist/ _py$python_version-$operating_system @@ -262,16 +262,16 @@ jobs: rm -rf thirdparty build dist rm -rf .eggs src/scancode_toolkit.egg-info src/scancode_toolkit_mini.egg-info mkdir -p thirdparty + venv/bin/python etc/scripts/fetch_thirdparty.py \ + --requirements=requirements-native.txt \ + --dest=thirdparty \ + --sdists venv/bin/python etc/scripts/fetch_thirdparty.py \ --requirements=requirements.txt \ --dest=thirdparty \ --python-version=$python_version \ --operating-system=$operating_system \ --wheels - venv/bin/python etc/scripts/fetch_thirdparty.py \ - --requirements=requirements-native.txt \ - --dest=thirdparty \ - --sdists venv/bin/python setup.py --quiet sdist --formats=$formats venv/bin/python etc/release/scancode_rename_archives.py dist/ _py$python_version-$operating_system diff --git a/configure b/configure index 588fc27eb17..fb24a432ab5 100755 --- a/configure +++ b/configure @@ -1,8 +1,9 @@ #!/usr/bin/env bash # # Copyright (c) nexB Inc. and others. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: Apache-2.0 AND MIT # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. +# ScanCode is a trademark of nexB Inc. # See https://github.com/nexB/ for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # @@ -10,6 +11,119 @@ set -e #set -x +################################################################################### +################################################################################### +# from https://raw.githubusercontent.com/mkropat/sh-realpath/58c03982cfd8accbcf0c4426a4adf0f120a8b2bb/realpath.sh +# realpath emulation for portability on *nix +# this allow running scancode from arbitrary locations and from symlinks +# +# Copyright (c) 2014 Michael Kropat +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + + +realpath() { + canonicalize_path "$(resolve_symlinks "$1")" +} + +resolve_symlinks() { + _resolve_symlinks "$1" +} + +_resolve_symlinks() { + _assert_no_path_cycles "$@" || return + + local dir_context path + path=$(readlink -- "$1") + if [ $? -eq 0 ]; then + dir_context=$(dirname -- "$1") + _resolve_symlinks "$(_prepend_dir_context_if_necessary "$dir_context" "$path")" "$@" + else + printf '%s\n' "$1" + fi +} + +_prepend_dir_context_if_necessary() { + if [ "$1" = . ]; then + printf '%s\n' "$2" + else + _prepend_path_if_relative "$1" "$2" + fi +} + +_prepend_path_if_relative() { + case "$2" in + /* ) printf '%s\n' "$2" ;; + * ) printf '%s\n' "$1/$2" ;; + esac +} + +_assert_no_path_cycles() { + local target path + + target=$1 + shift + + for path in "$@"; do + if [ "$path" = "$target" ]; then + return 1 + fi + done +} + +canonicalize_path() { + if [ -d "$1" ]; then + _canonicalize_dir_path "$1" + else + _canonicalize_file_path "$1" + fi +} + +_canonicalize_dir_path() { + (cd "$1" 2>/dev/null && pwd -P) +} + +_canonicalize_file_path() { + local dir file + dir=$(dirname -- "$1") + file=$(basename -- "$1") + (cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file") +} + +################################################################################### +################################################################################### + +# Now run configure proper + +################################ +# Setup current directory where this script lives +CFG_BIN="$( realpath "${BASH_SOURCE[0]}" )" +CFG_ROOT_DIR="$( cd "$( dirname "${CFG_BIN}" )" && pwd )" + +CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin + +# force relaunching under X86-64 architecture on macOS M1/ARM +if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' ]]; then + arch -x86_64 /bin/bash -c "$CFG_ROOT_DIR/configure $@" + exit $? +fi + ################################ # A configuration script to set things up: # create a virtualenv and install or update thirdparty packages. @@ -52,14 +166,21 @@ CFG_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin +################################ +# Install with or without and index. With "--no-index" this is using only local wheels +# This is an offline mode with no index and no network operations +NO_INDEX="--no-index " + + ################################ # Thirdparty package locations and index handling -# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org -# offline mode for scancode installation with no index at all -if [ -d "$CFG_ROOT_DIR/thirdparty" ]; then - PIP_EXTRA_ARGS="--no-index --find-links $CFG_ROOT_DIR/thirdparty" +# Find packages from the local thirdparty directory if present +thirddir=$CFG_ROOT_DIR/thirdparty +if [[ "$(echo $thirddir/*.whl)x" != "$thirddir/*.whlx" ]]; then + PIP_EXTRA_ARGS="$NO_INDEX --find-links $CFG_ROOT_DIR/thirdparty" fi + ################################ # Set the quiet flag to empty if not defined if [[ "$CFG_QUIET" == "" ]]; then @@ -102,25 +223,13 @@ create_virtualenv() { wget -O "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL" 2>/dev/null || curl -o "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL" fi - if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' ]]; then - arch -x86_64 /bin/bash -c "$PYTHON_EXECUTABLE \"$VIRTUALENV_PYZ\" \ - --wheel embed --pip embed --setuptools embed \ - --seeder pip \ - --never-download \ - --no-periodic-update \ - --no-vcs-ignore \ - $CFG_QUIET \ - \"$CFG_ROOT_DIR/$VENV_DIR\" " - else - $PYTHON_EXECUTABLE "$VIRTUALENV_PYZ" \ - --wheel embed --pip embed --setuptools embed \ - --seeder pip \ - --never-download \ - --no-periodic-update \ - --no-vcs-ignore \ - $CFG_QUIET \ - "$CFG_ROOT_DIR/$VENV_DIR" - fi + $PYTHON_EXECUTABLE "$VIRTUALENV_PYZ" \ + --wheel embed --pip embed --setuptools embed \ + --never-download \ + --no-periodic-update \ + --no-vcs-ignore \ + $CFG_QUIET \ + "$CFG_ROOT_DIR/$VENV_DIR" fi } diff --git a/etc/scripts/fetch_thirdparty.py b/etc/scripts/fetch_thirdparty.py index 26d520f7cee..89d17ded325 100755 --- a/etc/scripts/fetch_thirdparty.py +++ b/etc/scripts/fetch_thirdparty.py @@ -110,7 +110,6 @@ is_flag=True, help="Use on disk cached PyPI indexes list of packages and versions and do not refetch if present.", ) - @click.help_option("-h", "--help") def fetch_thirdparty( requirements_files, diff --git a/etc/scripts/misc/openhub_scraper.py b/etc/scripts/misc/openhub_scraper.py index 688486c0efd..065b59efa56 100644 --- a/etc/scripts/misc/openhub_scraper.py +++ b/etc/scripts/misc/openhub_scraper.py @@ -65,7 +65,7 @@ def fetch_and_save_license(url, force=False, directory="openhub_licenses"): os.makedirs(directory, exist_ok=True) print(f" Fetching: {url}") - time.sleep(.1) + time.sleep(0.1) content = urlopen(url).read() with open(lic_file, "wb") as of: of.write(content) diff --git a/etc/scripts/misc/test_openhub_scraper.py b/etc/scripts/misc/test_openhub_scraper.py index 5fa70d24dcf..cb5e36baeb4 100644 --- a/etc/scripts/misc/test_openhub_scraper.py +++ b/etc/scripts/misc/test_openhub_scraper.py @@ -14,24 +14,26 @@ def test_scraping_unicode_and_ascii(): - test_file = os.path.join( - os.path.dirname(__file__), "testdata/openhub_html.html" - ) + test_file = os.path.join(os.path.dirname(__file__), "testdata/openhub_html.html") with open(test_file, "r") as f: test_content = f.read() licenses = list(openhub_scraper.list_licenses_on_page(test_content)) result = [i for i in licenses if i["name"] == "Sleepycat License"] - expected = [{ - "url": "https://www.openhub.net/licenses/sleepycat", - "name": "Sleepycat License", - }] + expected = [ + { + "url": "https://www.openhub.net/licenses/sleepycat", + "name": "Sleepycat License", + } + ] assert result == expected result = [i for i in licenses if i["name"] == "Sun Public License v1.0"] - expected = [{ - "url": "https://www.openhub.net/licenses/sun_public", - "name": "Sun Public License v1.0", - }] + expected = [ + { + "url": "https://www.openhub.net/licenses/sun_public", + "name": "Sun Public License v1.0", + } + ] assert result == expected diff --git a/etc/scripts/utils_thirdparty.py b/etc/scripts/utils_thirdparty.py index 9cbda374ae1..53f2d33cc40 100755 --- a/etc/scripts/utils_thirdparty.py +++ b/etc/scripts/utils_thirdparty.py @@ -311,6 +311,7 @@ def download_sdist(name, version, dest_dir=THIRDPARTY_DIR, repos=tuple()): return fetched_sdist_filename + ################################################################################ # # Core models @@ -1064,16 +1065,16 @@ def get_sdist_name_ver_ext(filename): if version.isalpha(): return False - # non-pep 440 version + # non-pep 440 version if "-" in version: return False - # single version + # single version if version.isdigit() and len(version) == 1: return False - # r1 version - if len(version) == 2 and version[0]=="r" and version[1].isdigit(): + # r1 version + if len(version) == 2 and version[0] == "r" and version[1].isdigit(): return False # dotless version (but calver is OK) @@ -1588,6 +1589,7 @@ def tags(self): ) ) + ################################################################################ # # PyPI repo and link index for package wheels and sources @@ -1629,7 +1631,9 @@ class PypiSimpleRepository: use_cached_index = attr.ib( type=bool, default=False, - metadata=dict(help="If True, use any existing on-disk cached PyPI index files. Otherwise, fetch and cache."), + metadata=dict( + help="If True, use any existing on-disk cached PyPI index files. Otherwise, fetch and cache." + ), ) def _get_package_versions_map(self, name): @@ -1674,6 +1678,7 @@ def get_package_version(self, name, version=None): """ if not version: versions = list(self._get_package_versions_map(name).values()) + # return the latest version return versions and versions[-1] else: return self._get_package_versions_map(name).get(version) @@ -1724,7 +1729,9 @@ class LinksRepository: use_cached_index = attr.ib( type=bool, default=False, - metadata=dict(help="If True, use any existing on-disk cached index files. Otherwise, fetch and cache."), + metadata=dict( + help="If True, use any existing on-disk cached index files. Otherwise, fetch and cache." + ), ) def __attrs_post_init__(self): @@ -1790,6 +1797,7 @@ def from_url(cls, url=ABOUT_BASE_URL, _LINKS_REPO={}, use_cached_index=False): _LINKS_REPO[url] = cls(url=url, use_cached_index=use_cached_index) return _LINKS_REPO[url] + ################################################################################ # Globals for remote repos to be lazily created and cached on first use for the # life of the session together with some convenience functions. @@ -1803,6 +1811,7 @@ def get_local_packages(directory=THIRDPARTY_DIR): """ return list(PypiPackage.packages_from_dir(directory=directory)) + ################################################################################ # # Basic file and URL-based operations using a persistent file-based Cache @@ -1953,6 +1962,7 @@ def fetch_and_save( fo.write(content) return content + ################################################################################ # # Functions to update or fetch ABOUT and license files @@ -2051,7 +2061,9 @@ def get_other_dists(_package, _dist): # if has key data we may look to improve later, but we can move on if local_dist.has_key_metadata(): local_dist.save_about_and_notice_files(dest_dir=dest_dir) - local_dist.fetch_license_files(dest_dir=dest_dir, use_cached_index=use_cached_index) + local_dist.fetch_license_files( + dest_dir=dest_dir, use_cached_index=use_cached_index + ) continue # lets try to fetch remotely @@ -2089,7 +2101,9 @@ def get_other_dists(_package, _dist): # if has key data we may look to improve later, but we can move on if local_dist.has_key_metadata(): local_dist.save_about_and_notice_files(dest_dir=dest_dir) - local_dist.fetch_license_files(dest_dir=dest_dir, use_cached_index=use_cached_index) + local_dist.fetch_license_files( + dest_dir=dest_dir, use_cached_index=use_cached_index + ) continue # try to get data from pkginfo (no license though) @@ -2107,6 +2121,7 @@ def get_other_dists(_package, _dist): lic_errs = "\n".join(lic_errs) print(f"Failed to fetch some licenses:: {lic_errs}") + ################################################################################ # # Functions to build new Python wheels including native on multiple OSes @@ -2210,6 +2225,7 @@ def download_wheels_with_pip( downloaded = existing ^ set(os.listdir(dest_dir)) return sorted(downloaded), error + ################################################################################ # # Functions to check for problems diff --git a/extractcode b/extractcode index 12717a1aa1a..e1affed9aa9 100755 --- a/extractcode +++ b/extractcode @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright (c) nexB Inc. and others. All rights reserved. # SPDX-License-Identifier: Apache-2.0 AND MIT @@ -7,9 +7,15 @@ # See https://github.com/nexB/scancode-toolkit for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # + # A minimal shell wrapper to the CLI entry point fo ScanCode +set -e +#set -x + +COMMAND_TO_RUN=extractcode +################################################################################### ################################################################################### # from https://raw.githubusercontent.com/mkropat/sh-realpath/58c03982cfd8accbcf0c4426a4adf0f120a8b2bb/realpath.sh # realpath emulation for portability on *nix @@ -35,6 +41,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. + realpath() { canonicalize_path "$(resolve_symlinks "$1")" } @@ -104,15 +111,30 @@ _canonicalize_file_path() { } ################################################################################### +################################################################################### + # Now run scancode proper +################################ +# Setup current directory where this script lives SCANCODE_BIN="$( realpath "${BASH_SOURCE[0]}" )" SCANCODE_ROOT_DIR="$( cd "$( dirname "${SCANCODE_BIN}" )" && pwd )" +# force relaunching under X86-64 architecture on macOS M1/ARM +if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' ]]; then + arch -x86_64 /bin/bash -c "$SCANCODE_ROOT_DIR/$COMMAND_TO_RUN $@" + exit $? +fi + + SCANCODE_CONFIGURED_PYTHON="$SCANCODE_ROOT_DIR/venv/bin/python" if [ ! -f "$SCANCODE_CONFIGURED_PYTHON" ]; then + set -e echo "* Configuring ScanCode for first use..." CFG_QUIET=-qq "$SCANCODE_ROOT_DIR/configure" + set +e fi -"$SCANCODE_ROOT_DIR/venv/bin/extractcode" "$@" +if [ -f "$SCANCODE_CONFIGURED_PYTHON" ]; then + "$SCANCODE_ROOT_DIR/venv/bin/$COMMAND_TO_RUN" "$@" +fi diff --git a/scancode b/scancode index 64909be0e59..3547d0fadd0 100755 --- a/scancode +++ b/scancode @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright (c) nexB Inc. and others. All rights reserved. # SPDX-License-Identifier: Apache-2.0 AND MIT @@ -10,7 +10,12 @@ # A minimal shell wrapper to the CLI entry point fo ScanCode +set -e +#set -x +COMMAND_TO_RUN=scancode + +################################################################################### ################################################################################### # from https://raw.githubusercontent.com/mkropat/sh-realpath/58c03982cfd8accbcf0c4426a4adf0f120a8b2bb/realpath.sh # realpath emulation for portability on *nix @@ -36,6 +41,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. + realpath() { canonicalize_path "$(resolve_symlinks "$1")" } @@ -105,11 +111,22 @@ _canonicalize_file_path() { } ################################################################################### +################################################################################### + # Now run scancode proper +################################ +# Setup current directory where this script lives SCANCODE_BIN="$( realpath "${BASH_SOURCE[0]}" )" SCANCODE_ROOT_DIR="$( cd "$( dirname "${SCANCODE_BIN}" )" && pwd )" +# force relaunching under X86-64 architecture on macOS M1/ARM +if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' ]]; then + arch -x86_64 /bin/bash -c "$SCANCODE_ROOT_DIR/$COMMAND_TO_RUN $@" + exit $? +fi + + SCANCODE_CONFIGURED_PYTHON="$SCANCODE_ROOT_DIR/venv/bin/python" if [ ! -f "$SCANCODE_CONFIGURED_PYTHON" ]; then set -e @@ -119,6 +136,5 @@ if [ ! -f "$SCANCODE_CONFIGURED_PYTHON" ]; then fi if [ -f "$SCANCODE_CONFIGURED_PYTHON" ]; then - "$SCANCODE_ROOT_DIR/venv/bin/scancode" "$@" + "$SCANCODE_ROOT_DIR/venv/bin/$COMMAND_TO_RUN" "$@" fi - diff --git a/src/formattedcode/output_csv.py b/src/formattedcode/output_csv.py index 2bad83a5881..b1da8a6f454 100644 --- a/src/formattedcode/output_csv.py +++ b/src/formattedcode/output_csv.py @@ -140,7 +140,7 @@ def collect_keys(mapping, key_group): for mrk, mrv in val.items(): if mrk in ('match_coverage', 'rule_relevance'): # normalize the string representation of this number - mrv = '{:.2f}'.format(mrv) + mrv = with_two_decimals(mrv) else: mrv = pretty(mrv) mrk = 'matched_rule__' + mrk @@ -148,8 +148,7 @@ def collect_keys(mapping, key_group): continue if k == 'score': - # normalize score with two decimal values - val = '{:.2f}'.format(val) + val = with_two_decimals(val) # lines are present in multiple scans: keep their column name as # not scan-specific. Prefix othe columns with license__ @@ -201,6 +200,17 @@ def collect_keys(mapping, key_group): yield flat +def with_two_decimals(val): + """ + Return a normalized score string with two decimal values + """ + if isinstance(val, (float, int)): + val = '{:.2f}'.format(val) + if not isinstance(val, str): + val = str(val) + return val + + def pretty(data): """ Return a unicode text pretty representation of data (as YAML or else) if diff --git a/src/licensedcode/models.py b/src/licensedcode/models.py index 31e4d71d0b3..c681a43828a 100644 --- a/src/licensedcode/models.py +++ b/src/licensedcode/models.py @@ -544,6 +544,9 @@ def validate(licenses, verbose=False, no_dupe_urls=False): if len(lic.key) > 50: error('key must be 50 characters or less.') + if '_'in lic.key: + error('key cannot contain an underscore: this is not valid in SPDX.') + if not lic.short_name: error('No short name') elif len(lic.short_name) > 50: diff --git a/src/packagedcode/build_gradle.py b/src/packagedcode/build_gradle.py index f9649fa763b..915a08ddf9a 100644 --- a/src/packagedcode/build_gradle.py +++ b/src/packagedcode/build_gradle.py @@ -6,6 +6,8 @@ # See https://github.com/nexB/scancode-toolkit for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # +import os +import sys from packageurl import PackageURL from pygmars import Token @@ -15,6 +17,35 @@ from packagedcode import groovy_lexer from packagedcode import models +# Tracing flags +TRACE = False or os.environ.get('SCANCODE_DEBUG_PACKAGE_GRADLE', False) + +# set to 1 to enable pygmars deep tracing +TRACE_DEEP = 0 +if os.environ.get('SCANCODE_DEBUG_PACKAGE_GRADLE_DEEP'): + TRACE_DEEP = 1 + TRACE = False + + +# Tracing flags +def logger_debug(*args): + pass + + +if TRACE or TRACE_DEEP: + import logging + + logger = logging.getLogger(__name__) + logging.basicConfig(stream=sys.stdout) + logger.setLevel(logging.DEBUG) + if True: + printer = print + else: + printer = logger.debug + + def logger_debug(*args): + return printer(' '.join(isinstance(a, str) and a or repr(a) for a in args)) + # TODO: split groovy and kotlin handlers @@ -76,18 +107,29 @@ def get_pygmar_tokens(contents): yield token -def get_parse_tree(build_gradle_location): +def get_parse_tree(build_gradle_location, trace=TRACE_DEEP): """ Return a Pygmars parse tree from a ``build_gradle_location`` build.gradle """ with open(build_gradle_location) as f: contents = f.read() - parser = Parser(grammar, trace=0) - return parser.parse(list(get_pygmar_tokens(contents))) + + parser = Parser(grammar, trace=trace) + + lexed_tokens = list(get_pygmar_tokens(contents)) + if TRACE: + logger_debug(f'get_parse_tree: lexed_tokens: {lexed_tokens}') + + parse_tree = parser.parse(lexed_tokens) + + if TRACE: + logger_debug(f'get_parse_tree: parse_tree: {parse_tree}') + + return parse_tree def is_literal_string(string): - return string == 'LITERAL-STRING-SINGLE' or string == 'LITERAL-STRING-DOUBLE' + return string in ('LITERAL-STRING-SINGLE', 'LITERAL-STRING-DOUBLE') def remove_quotes(string): @@ -107,7 +149,9 @@ def remove_quotes(string): def get_dependencies_from_parse_tree(parse_tree): - dependencies = [] + """ + Yield dependency mappings from a Pygmars parse tree. + """ in_dependency_block = False brackets_counter = 0 first_bracket_seen = False @@ -120,7 +164,7 @@ def get_dependencies_from_parse_tree(parse_tree): continue if in_dependency_block: - if tree_node.label == 'OPERATOR': + if tree_node.label.startswith('OPERATOR'): if tree_node.value == '{': if not first_bracket_seen: first_bracket_seen = True @@ -159,7 +203,7 @@ def get_dependencies_from_parse_tree(parse_tree): dependency[last_key] = remove_quotes(child_node.value) if scope: dependency['scope'] = scope - dependencies.append(dependency) + yield dependency if in_nested_dependency: if tree_node.label == 'OPERATOR' and tree_node.value == ')': @@ -186,7 +230,7 @@ def get_dependencies_from_parse_tree(parse_tree): dependency[last_key] = remove_quotes(value) if in_nested_dependency and scope: dependency['scope'] = scope - dependencies.append(dependency) + yield dependency if tree_node.label == 'DEPENDENCY-2': dependency = {} @@ -216,25 +260,37 @@ def get_dependencies_from_parse_tree(parse_tree): dependency['namespace'] = namespace dependency['name'] = name dependency['version'] = version - dependencies.append(dependency) + yield dependency if tree_node.label == 'DEPENDENCY-3': dependency = {} for child_node in tree_node.leaves(): + if TRACE: + logger_debug('DEPENDENCY-3:', child_node) if child_node.label == 'NAME': dependency['scope'] = child_node.value - if is_literal_string(child_node.label): + + elif is_literal_string(child_node.label): + value = child_node.value value = remove_quotes(value) + # We are assuming `value` is in the form of "namespace:name:version" split_dependency_string = value.split(':') - if len(split_dependency_string) != 3: - break - namespace, name, version = split_dependency_string - dependency['namespace'] = namespace - dependency['name'] = name - dependency['version'] = version - dependencies.append(dependency) + if TRACE: + logger_debug('DEPENDENCY-3: is_literal_string: value', value, 'split_dependency_string:', split_dependency_string) + length = len(split_dependency_string) + if length == 3: + namespace, name, version = split_dependency_string + dependency['namespace'] = namespace + dependency['name'] = name + dependency['version'] = version + elif length == 2: + namespace, name = split_dependency_string + dependency['namespace'] = namespace + dependency['name'] = name + + yield dependency # TODO: See if you can refactor logic with DEPENDENCY-1 if tree_node.label == 'DEPENDENCY-4': @@ -253,7 +309,7 @@ def get_dependencies_from_parse_tree(parse_tree): last_key = 'version' if is_literal_string(child_node.label): dependency[last_key] = remove_quotes(child_node.value) - dependencies.append(dependency) + yield dependency if tree_node.label == 'DEPENDENCY-5': dependency = {} @@ -262,17 +318,20 @@ def get_dependencies_from_parse_tree(parse_tree): dependency['scope'] = child_node.value if child_node.label == 'NAME-ATTRIBUTE': dependency['name'] = child_node.value - dependencies.append(dependency) - return dependencies + yield dependency + def get_dependencies(build_gradle_location): parse_tree = get_parse_tree(build_gradle_location) # Parse `parse_tree` for dependencies and print them - return get_dependencies_from_parse_tree(parse_tree) + return list(get_dependencies_from_parse_tree(parse_tree)) def build_package(cls, dependencies): + """ + Yield PackageData from a ``dependencies`` list of mappings. + """ package_dependencies = [] for dependency in dependencies: # Ignore collected dependencies that do not have a name @@ -301,6 +360,7 @@ def build_package(cls, dependencies): extracted_requirement=version, is_runtime=is_runtime, is_optional=is_optional, + is_resolved=bool(version), ) ) diff --git a/src/packagedcode/groovy_lexer.py b/src/packagedcode/groovy_lexer.py index 42bab16a8ad..73d570f3855 100644 --- a/src/packagedcode/groovy_lexer.py +++ b/src/packagedcode/groovy_lexer.py @@ -1,5 +1,5 @@ """ -Minimal lexer for Groovy +Minimal lexer for Groovy and Kotlin gradle scripts Derived from pygments.lexers.jvm and significantly modified copyright: Copyright 2006-2021 by the Pygments team, see groovy_lexer.py.AUTHORS. SPDX-License-Identifier: BSD-2-Clause @@ -32,7 +32,7 @@ class GroovyLexer(RegexLexer): name = 'Groovy' aliases = ['groovy'] - filenames = ['*.groovy', '*.gradle'] + filenames = ['*.groovy', '*.gradle', '*.gradle.kts'] mimetypes = ['text/x-groovy'] flags = re.MULTILINE | re.DOTALL diff --git a/src/packagedcode/npm.py b/src/packagedcode/npm.py index fee75fd2dcb..d8b3b24a352 100644 --- a/src/packagedcode/npm.py +++ b/src/packagedcode/npm.py @@ -89,6 +89,9 @@ def assemble(cls, package_data, resource, codebase): if not package.license_expression: package.license_expression = compute_normalized_license(package.declared_license) + # Always yield the package resource in all cases and first! + yield package + root = package_resource.parent(codebase) if root: for npm_res in cls.walk_npm(resource=root, codebase=codebase): @@ -100,10 +103,8 @@ def assemble(cls, package_data, resource, codebase): if package_uid not in package_resource.for_packages: package_resource.for_packages.append(package_uid) package_resource.save(codebase) - - # Always yield the package resource in all cases yield package_resource - yield package + else: # we have no package, so deps are not for a specific package uid package_uid = None diff --git a/src/packagedcode/plugin_package.py b/src/packagedcode/plugin_package.py index 4bf9b7a7f51..da93911b999 100644 --- a/src/packagedcode/plugin_package.py +++ b/src/packagedcode/plugin_package.py @@ -27,7 +27,7 @@ from packagedcode.models import PackageData from packagedcode.models import PackageWithResources -TRACE = os.environ.get('SCANCODE_DEBUG_PACKAGE', False) +TRACE = os.environ.get('SCANCODE_DEBUG_PACKAGE_API', False) def logger_debug(*args): diff --git a/src/packagedcode/pypi.py b/src/packagedcode/pypi.py index e88a17b9ee4..c0a9365446d 100644 --- a/src/packagedcode/pypi.py +++ b/src/packagedcode/pypi.py @@ -9,7 +9,6 @@ # import ast -import io import json import logging import os @@ -65,7 +64,7 @@ def logger_debug(*args): logger.setLevel(logging.DEBUG) def logger_debug(*args): - return logger.debug(' '.join(isinstance(a, str) and a or repr(a) for a in args)) + return print(' '.join(isinstance(a, str) and a or repr(a) for a in args)) class BasePypiHandler(models.DatafileHandler): @@ -227,17 +226,18 @@ def assemble(cls, package_data, resource, codebase): else: package_uid = None - for sibling in package_resource.siblings(codebase): - if sibling.name in datafile_name_patterns: - yield from yield_dependencies_from_package_resource( - resource=sibling, - package_uid=package_uid - ) + if package_resource: + for sibling in package_resource.siblings(codebase): + if sibling and sibling.name in datafile_name_patterns: + yield from yield_dependencies_from_package_resource( + resource=sibling, + package_uid=package_uid + ) - if package_uid and package_uid not in sibling.for_packages: - sibling.for_packages.append(package_uid) - sibling.save(codebase) - yield sibling + if package_uid and package_uid not in sibling.for_packages: + sibling.for_packages.append(package_uid) + sibling.save(codebase) + yield sibling @classmethod def walk_pypi(cls, resource, codebase): @@ -439,7 +439,7 @@ def parse_metadata(location, datasource_id, package_type): name = get_attribute(meta, 'Name') version = get_attribute(meta, 'Version') - urls = get_urls(metainfo=meta, name=name, version=version) + urls, extra_data = get_urls(metainfo=meta, name=name, version=version) dependencies = get_dist_dependencies(dist) @@ -457,6 +457,7 @@ def parse_metadata(location, datasource_id, package_type): parties=get_parties(meta), dependencies=dependencies, file_references=file_references, + extra_data=extra_data, **urls, ) @@ -582,7 +583,7 @@ def parse(cls, location): name = sdist.name version = sdist.version - urls = get_urls(metainfo=sdist, name=name, version=version) + urls, extra_data = get_urls(metainfo=sdist, name=name, version=version) yield models.PackageData( datasource_id=cls.datasource_id, @@ -594,6 +595,7 @@ def parse(cls, location): declared_license=get_declared_license(sdist), keywords=get_keywords(sdist), parties=get_parties(sdist), + extra_data=extra_data, **urls, ) @@ -619,7 +621,12 @@ def parse(cls, location): # search for possible dunder versions here and elsewhere version = detect_version_attribute(location) - urls = get_urls(metainfo=setup_args, name=name, version=version) + urls, extra_data = get_urls(metainfo=setup_args, name=name, version=version) + + dependencies = get_setup_py_dependencies(setup_args) + python_requires = get_setup_py_python_requires(setup_args) + extra_data.update(python_requires) + yield models.PackageData( datasource_id=cls.datasource_id, type=cls.default_package_type, @@ -627,10 +634,11 @@ def parse(cls, location): name=name, version=version, description=get_description(setup_args), - parties=get_parties(setup_args), + parties=get_setup_parties(setup_args), declared_license=get_declared_license(setup_args), - dependencies=get_setup_py_dependencies(setup_args), + dependencies=dependencies, keywords=get_keywords(setup_args), + extra_data=extra_data, **urls, ) @@ -790,30 +798,37 @@ class PipRequirementsFileHandler(BaseDependencyFileHandler): @classmethod def parse(cls, location): - dependencies = get_requirements_txt_dependencies(location=location) + dependencies, extra_data = get_requirements_txt_dependencies(location=location) yield models.PackageData( datasource_id=cls.datasource_id, type=cls.default_package_type, primary_language=cls.default_primary_language, dependencies=dependencies, + extra_data=extra_data, ) +# TODO: enable nested load + -def get_requirements_txt_dependencies(location): +def get_requirements_txt_dependencies(location, include_nested=False): """ - Return a list of DependentPackage found in a requirements file at - ``location`` or an empty list. + Return a two-tuple of (list of deps, mapping of extra data) list of + DependentPackage found in a requirements file at ``location`` or tuple of + ([], {}) """ req_file = pip_requirements_parser.RequirementsFile.from_file( filename=location, - include_nested=False, + include_nested=include_nested, ) if not req_file or not req_file.requirements: return [] - dependent_packages = [] + # for now we ignore errors + extra_data = {} + for opt in req_file.options: + extra_data.update(opt.options) - # for now we ignore plain options and errors + dependent_packages = [] for req in req_file.requirements: if req.name: @@ -852,7 +867,7 @@ def get_requirements_txt_dependencies(location): ) ) - return dependent_packages + return dependent_packages, extra_data def get_attribute(metainfo, name, multiple=False): @@ -1020,14 +1035,24 @@ def get_keywords(metainfo): return keywords -def get_parties(metainfo): +def get_parties( + metainfo, + author_key='Author', + author_email_key='Author-email', + maintainer_key='Maintainer', + maintainer_email_key='Maintainer-email', + +): """ Return a list of parties found in a ``metainfo`` object or mapping. + Uses the provided keys with a default to key names used in METADATA. + setup.py and setup.cfg use lower case valid Python identifiers instead. """ parties = [] - author = get_attribute(metainfo, 'Author') - author_email = get_attribute(metainfo, 'Author-email') + author = get_attribute(metainfo, author_key) + + author_email = get_attribute(metainfo, author_email_key) if author or author_email: parties.append(models.Party( type=models.party_person, @@ -1036,8 +1061,8 @@ def get_parties(metainfo): email=author_email or None, )) - maintainer = get_attribute(metainfo, 'Maintainer') - maintainer_email = get_attribute(metainfo, 'Maintainer-email') + maintainer = get_attribute(metainfo, maintainer_key) + maintainer_email = get_attribute(metainfo, maintainer_email_key) if maintainer or maintainer_email: parties.append(models.Party( type=models.party_person, @@ -1049,6 +1074,32 @@ def get_parties(metainfo): return parties +def get_setup_parties(setup_kwargs): + """ + Return a list of parties found in a ``setup_kwargs`` mapping of data found + in setup.py or setup.cfg. + """ + return get_parties( + metainfo=setup_kwargs, + author_key='author', + author_email_key='author_email', + maintainer_key='maintainer', + maintainer_email_key='maintainer_email', + ) + + +def get_setup_py_python_requires(setup_args): + """ + Return a mapping of {python_requires: value} or an empty mapping found in a + ``setup_args`` mapping of setup.py arguments. + """ + python_requires = setup_args.get('python_requires') + if python_requires: + return dict(python_requires=python_requires) + else: + return {} + + def get_setup_py_dependencies(setup_args): """ Return a list of DependentPackage found in a ``setup_args`` mapping of @@ -1056,11 +1107,6 @@ def get_setup_py_dependencies(setup_args): """ dependencies = [] - python_requires = setup_args.get('python_requires') - if python_requires: - # FIXME: handle python_requires = >=3.6.* - pass - install_requires = setup_args.get('install_requires') dependencies.extend(get_requires_dependencies(install_requires, default_scope='install')) @@ -1074,7 +1120,7 @@ def get_setup_py_dependencies(setup_args): get_requires_dependencies(setup_requires, default_scope='setup') ) - extras_require = setup_args.get('extras_require', {}) + extras_require = setup_args.get('extras_require') or {} for scope, requires in extras_require.items(): dependencies.extend( get_requires_dependencies(requires, default_scope=scope) @@ -1256,9 +1302,36 @@ def parse_with_dparse2(location, file_name=None): return dependent_packages -def get_setup_py_args(location): +def is_setup_call(statement): """ - Return a mapping of arguments passed to a setup.py setup() function. + Return if the AST ``statement`` is a call to the setup() function. + """ + return ( + isinstance(statement, (ast.Expr, ast.Call, ast.Assign)) + and isinstance(statement.value, ast.Call) + and ( + # we look for setup and main as this is used sometimes instead of setup() + ( + isinstance(statement.value.func, ast.Name) + and statement.value.func.id in ('setup', 'main') + ) + or + # we also look for setuptools.setup when used instead of setup() + ( + isinstance(statement.value.func, ast.Attribute) + and statement.value.func.attr == 'setup' + and isinstance(statement.value.func.value, ast.Name) + and statement.value.func.value.id == 'setuptools' + ) + ) + ) + + +def get_setup_py_args_legacy(location, include_not_parsable=False): + """ + Return a mapping of arguments passed to a setup.py setup() function. Also + include not parsable identifiers values such as variable name and attribute + references if ``include_not_parsable`` is True """ with open(location) as inp: setup_text = inp.read() @@ -1270,37 +1343,104 @@ def get_setup_py_args(location): for statement in tree.body: # We only care about function calls or assignments to functions named # `setup` or `main` - if not ( - isinstance(statement, (ast.Expr, ast.Call, ast.Assign)) - and isinstance(statement.value, ast.Call) - and isinstance(statement.value.func, ast.Name) - # we also look for main as sometimes this is used instead of setup() - and statement.value.func.id in ('setup', 'main') - ): + + # TODO: also collect top level variables assigned later as arguments values + if not is_setup_call(statement): continue # Process the arguments to the setup function for kw in getattr(statement.value, 'keywords', []): arg_name = kw.arg + arg_value = kw.value - if isinstance(kw.value, ast.Str): - setup_args[arg_name] = kw.value.s + # FIXME: use a recursive function to extract structured data - elif isinstance(kw.value, (ast.List, ast.Tuple, ast.Set,)): + if isinstance(arg_value, (ast.List, ast.Tuple, ast.Set,)): # We collect the elements of a list if the element # and tag function calls - value = [ - elt.s for elt in kw.value.elts + val = [ + elt.s for elt in arg_value.elts if not isinstance(elt, ast.Call) ] - setup_args[arg_name] = value - - # TODO: what if isinstance(kw.value, ast.Dict) - # or an expression like a call to version=get_version or version__version__ + setup_args[arg_name] = val + + elif isinstance(arg_value, ast.Dict): + # we only collect simple name/value and name/[values] constructs + keys = [elt.value for elt in arg_value.keys] + values = [] + for val in arg_value.values: + + if isinstance(val, (ast.List, ast.Tuple, ast.Set,)): + val = [ + elt.s for elt in val.elts + if not isinstance(elt, ast.Call) + ] + values.append(val) + + elif isinstance(val, (ast.Str, ast.Constant,)): + values.append(val.s) + + else: + if include_not_parsable: + if isinstance(val, ast.Attribute): + values.append(val.attr) + + elif isinstance(val, ast.Name): + values.append(val.id) + + elif not isinstance(val, (ast.Call, ast.ListComp, ast.Subscript)): + # we used to consider only isinstance(val, ast.Str): + # instead use literal_eval and ignore failures, skipping + # only function calls this way we can get more things such + # as boolean and numbers + try: + values.append(ast.literal_eval(val.value)) + except Exception as e: + if TRACE: + logger_debug('get_setup_py_args: failed:', e) + values.append(str(val.value)) + + mapping = dict(zip(keys, values)) + setup_args[arg_name] = mapping + + elif isinstance(arg_value, (ast.Str, ast.Constant,)): + setup_args[arg_name] = arg_value.s + else: + if include_not_parsable: + if isinstance(arg_value, ast.Attribute): + setup_args[arg_name] = arg_value.attr + + elif isinstance(arg_value, ast.Name): + if arg_name: + setup_args[arg_name] = arg_value.id + + elif not isinstance(arg_value, (ast.Call, ast.ListComp, ast.Subscript,)): + # we used to consider only isinstance(kw.value, ast.Str): + # instead use literal_eval and ignore failures, skipping only + # function calls this way we can get more things such as boolean + # and numbers + try: + setup_args[arg_name] = ast.literal_eval(arg_value) + except Exception as e: + if TRACE: + logger_debug('get_setup_py_args: failed:', e) + setup_args[arg_name] = str(arg_value) + + # TODO: an expression like a call to version=get_version or version__version__ return setup_args +def get_setup_py_args(location, include_not_parsable=False): + """ + Return a mapping of arguments passed to a setup.py setup() function. Also + include not parsable identifiers values such as variable name and attribute + references if ``include_not_parsable`` is True + """ + from packagedcode.pypi_setup_py import parse_setup_py + return parse_setup_py(location) + + def get_pypi_urls(name, version): """ Return a mapping of computed Pypi URLs for this package @@ -1326,11 +1466,12 @@ def get_pypi_urls(name, version): ) -def get_urls(metainfo, name, version, extra_data=None): +def get_urls(metainfo, name, version): """ - Return a mapping for URLs of this package: - - as plain name/values for URL attributes known in PackageData - - as a nested extra_data: mapping for other URLs (possibly updating extra_data if provided). + Return a mapping of standard URLs and a mapping of extra-data URls for URLs + of this package: + - standard URLs are for URL attributes known in PackageData + - extra_data for other URLs (possibly updating extra_data if provided). """ # Misc URLs to possibly track # Project-URL: Release notes @@ -1366,7 +1507,7 @@ def get_urls(metainfo, name, version, extra_data=None): # Project-URL: Twine source # Project-URL: Say Thanks! - extra_data = extra_data or {} + extra_data = {} urls = get_pypi_urls(name, version) def add_url(_url, _utype=None, _attribute=None): @@ -1394,45 +1535,49 @@ def add_url(_url, _utype=None, _attribute=None): or [] ) - for url in project_urls: - utype, _, uvalue = url.partition(',') - uvalue = uvalue.strip() - utype = utype.strip() - utypel = utype.lower() - if utypel in ( - 'tracker', - 'bug reports', - 'github: issues', - 'bug tracker', - 'issues', - 'issue tracker', - ): - add_url(url, _utype=utype, _attribute='bug_tracking_url') - - elif utypel in ( - 'source', - 'source code', - 'code', - ): - add_url(url, _utype=utype, _attribute='code_view_url') - - elif utypel in ('github', 'gitlab', 'github: repo', 'repository'): - add_url(url, _utype=utype, _attribute='vcs_url') - - elif utypel in ('website', 'homepage', 'home',): - add_url(url, _utype=utype, _attribute='homepage_url') + if isinstance(project_urls, list): + # these come from METADATA and we convert them back to a mapping + project_urls = [url.partition(', ') for url in project_urls] + project_urls = { + utype.strip(): uvalue.strip() + for utype, _, uvalue in project_urls + } + if isinstance(project_urls, dict): + for utype, url in project_urls.items(): + utypel = utype.lower() + if utypel in ( + 'tracker', + 'bug reports', + 'github: issues', + 'bug tracker', + 'issues', + 'issue tracker', + ): + add_url(url, _utype=utype, _attribute='bug_tracking_url') + + elif utypel in ( + 'source', + 'source code', + 'code', + ): + add_url(url, _utype=utype, _attribute='code_view_url') + + elif utypel in ('github', 'gitlab', 'github: repo', 'repository'): + add_url(url, _utype=utype, _attribute='vcs_url') + + elif utypel in ('website', 'homepage', 'home',): + add_url(url, _utype=utype, _attribute='homepage_url') - else: - add_url(url, _utype=utype) + else: + add_url(url, _utype=utype) - # FIXME: this may not be the actual correct package download URL, so for now - # we incorrectly set this as the vcs_url + # FIXME: this may not be the actual correct package download URL, so we keep this as an extra URL download_url = get_attribute(metainfo, 'Download-URL') - add_url(download_url, _utype='Download-URL', _attribute='vcs_url') + if not download_url: + download_url = get_attribute(metainfo, 'download_url') + add_url(download_url, _utype='Download-URL') - if extra_data: - urls['extra_data'] = extra_data - return urls + return urls, extra_data def find_pattern(location, pattern): @@ -1446,7 +1591,7 @@ def find_pattern(location, pattern): SPDX-License-Identifier: BSD-3-Clause (C) 2001-2020 Chris Liechti <cliechti@gmx.net> """ - with io.open(location, encoding='utf8') as fp: + with open(location) as fp: content = fp.read() match = re.search(pattern, content) @@ -1490,7 +1635,7 @@ def find_setup_py_dunder_version(location): setup( version=six.__version__, ... - would return six.__version__. + would return six.__version__ Code inspired and heavily modified from: https://github.com/pyserial/pyserial/blob/d867871e6aa333014a77498b4ac96fdd1d3bf1d8/setup.py#L34 @@ -1514,26 +1659,30 @@ def detect_version_attribute(setup_location): setup_version_arg = find_setup_py_dunder_version(setup_location) setup_py__version = find_dunder_version(setup_location) if TRACE: - logger_debug(' detect_dunder_version:', 'setup_location:', setup_location) - logger_debug(' setup_version_arg:', repr(setup_version_arg),) - logger_debug(' setup_py__version:', repr(setup_py__version),) + logger_debug(' detect_version_attribute():', 'setup_location:', setup_location) + logger_debug(' find_setup_py_dunder_version(): setup_version_arg:', repr(setup_version_arg),) + logger_debug(' find_dunder_version(): setup_py__version:', repr(setup_py__version),) if setup_version_arg == '__version__' and setup_py__version: version = setup_py__version or None - if TRACE: logger_debug(' detect_dunder_version: A:', version) + if TRACE: + logger_debug( + ' detect_dunder_version:', + "setup_version_arg == '__version__' and setup_py__version:", version) return version # here we have a more complex __version__ location # we start by adding the possible paths and file name # and we look at these in sequence - candidate_locs = [] - if setup_version_arg and '.' in setup_version_arg: segments = setup_version_arg.split('.')[:-1] else: segments = [] + if TRACE: + logger_debug(' detect_version_attribute():', 'segments:', segments) + special_names = ( '__init__.py', '__main__.py', @@ -1549,6 +1698,11 @@ def detect_version_attribute(setup_location): setup_py_dir = fileutils.parent_directory(setup_location) src_dir = os.path.join(setup_py_dir, 'src') has_src = os.path.exists(src_dir) + if TRACE: + logger_debug(' detect_version_attribute():', 'src_dir:', src_dir) + logger_debug(' detect_version_attribute():', 'has_src:', has_src) + + candidate_locs = [] if segments: for n in special_names: @@ -1574,6 +1728,8 @@ def detect_version_attribute(setup_location): os.path.join(setup_py_dir, *cand_loc_segs) for cand_loc_segs in candidate_locs ] + if TRACE: + logger_debug(' detect_version_attribute():', 'candidate_locs1:', candidate_locs) for fl in get_module_scripts( location=setup_py_dir, @@ -1583,21 +1739,28 @@ def detect_version_attribute(setup_location): candidate_locs.append(fl) if TRACE: + logger_debug(' detect_version_attribute():', 'candidate_locs2:') for loc in candidate_locs: - logger_debug(' can loc:', loc) + logger_debug(' loc:', loc) version = detect_version_in_locations( candidate_locs=candidate_locs, detector=find_dunder_version ) + if TRACE: + logger_debug(' detect_version_attribute():', 'version2:', version) if version: return version - return detect_version_in_locations( + version = detect_version_in_locations( candidate_locs=candidate_locs, detector=find_plain_version, ) + if TRACE: + logger_debug(' detect_version_attribute():', 'version3:', version) + + return version def detect_version_in_locations(candidate_locs, detector=find_plain_version): @@ -1605,18 +1768,21 @@ def detect_version_in_locations(candidate_locs, detector=find_plain_version): Return the first version found in a location from the `candidate_locs` list using the `detector` callable. Return None if no version is found. """ + if TRACE: + logger_debug(' detect_version_in_locations():', 'candidate_locs:', candidate_locs) + for loc in candidate_locs: if not os.path.exists(loc): continue - if TRACE: logger_debug('detect_version_in_locations:', 'loc:', loc) + if TRACE: logger_debug(' detect_version_in_locations:', 'loc:', loc) # here the file exists try to get a dunder version version = detector(loc) if TRACE: logger_debug( - 'detect_version_in_locations:', + ' detect_version_in_locations:', 'detector', detector, 'version:', version, ) @@ -1631,19 +1797,57 @@ def get_module_scripts(location, max_depth=1, interesting_names=()): `interesting_names` by walking the `location` directory recursively up to `max_depth` path segments extending from the root `location`. """ + if TRACE: + logger_debug( + ' get_module_scripts():', + 'location:', location, + 'max_depth:', max_depth, + 'interesting_names:', interesting_names + ) location = location.rstrip(os.path.sep) - current_depth = max_depth + if TRACE: logger_debug(' get_module_scripts:', 'location:', location) + for top, _dirs, files in os.walk(location): - if current_depth == 0: + current_depth = compute_path_depth(location, top) + if TRACE: + logger_debug(' get_module_scripts:', 'current_depth:', current_depth) + logger_debug(' get_module_scripts:', 'top:', top, '_dirs:', _dirs, 'files:', files) + if current_depth >= max_depth: break for f in files: + if TRACE: logger_debug(' get_module_scripts:', 'file:', f) + if f in interesting_names: path = os.path.join(top, f) - if TRACE: logger_debug('get_module_scripts:', 'path', path) + if TRACE: logger_debug(' get_module_scripts:', 'path:', path) yield path - current_depth -= 1 + +def compute_path_depth(base, path): + """ + Return the depth of ``path`` below ``base`` as the number of path segments + that ``path`` extends below ``base``. + For example: + >>> base = '/home/foo/bar' + >>> compute_path_depth(base, '/home/foo/bar/baz') + 1 + >>> compute_path_depth(base, base) + 0 + """ + base = base.strip(os.path.sep) + path = path.strip(os.path.sep) + + assert path.startswith(base) + subpath = path[len(base):].strip(os.path.sep) + segments = [s for s in subpath.split(os.path.sep) if s] + depth = len(segments) + if TRACE: + logger_debug( + ' compute_path_depth:', + 'base:', base, 'path:', path, 'subpath:', subpath, + 'segments:', segments, 'depth:', depth,) + return depth def compute_normalized_license(declared_license): diff --git a/src/packagedcode/pypi.py.ABOUT b/src/packagedcode/pypi.py.ABOUT new file mode 100644 index 00000000000..aa64a4d0617 --- /dev/null +++ b/src/packagedcode/pypi.py.ABOUT @@ -0,0 +1,13 @@ +about_resource: pypi.py +name: pyserial +namespace: pyserial +package_url: pkg:github/pyserial/pyserial@d867871e6aa33301#setup.py +attribute: yes +copyright: Copyright (c) 2001-2020 Chris Liechti <cliechti@gmx.net> +download_url: https://github.com/pyserial/pyserial/blob/d867871e6aa333014a77498b4ac96fdd1d3bf1d8/setup.py#L34 +license_expression: bsd-new +notice_file: pypi.py.NOTICE +primary_language: Python +notes: The functions find_pattern(), find_dunder_version(), + find_setup_py_dunder_version() are inspired and heavily modified from Pyserial + setup.py diff --git a/src/packagedcode/pypi.py.NOTICE b/src/packagedcode/pypi.py.NOTICE new file mode 100644 index 00000000000..6eb40f32ee3 --- /dev/null +++ b/src/packagedcode/pypi.py.NOTICE @@ -0,0 +1,39 @@ +Copyright (c) 2001-2020 Chris Liechti <cliechti@gmx.net> +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--------------------------------------------------------------------------- +Note: +Individual files contain the following tag instead of the full license text. + + SPDX-License-Identifier: BSD-3-Clause + +This enables machine processing of license information based on the SPDX +License Identifiers that are here available: http://spdx.org/licenses/ \ No newline at end of file diff --git a/src/packagedcode/pypi_setup_py.py b/src/packagedcode/pypi_setup_py.py new file mode 100644 index 00000000000..e7f55c7a0ac --- /dev/null +++ b/src/packagedcode/pypi_setup_py.py @@ -0,0 +1,211 @@ +# +# Copyright (c) Gram and others. +# This code is copied and modified from dephell_setuptools https://github.com/pypa/setuptools +# SPDX-License-Identifier: MIT +# See https://github.com/nexB/scancode-toolkit for support or download. +# See https://aboutcode.org for more information about nexB OSS projects. +# + + +import ast +from pathlib import Path + +""" +Parse setup.py files. +""" + +# https://setuptools.readthedocs.io/en/latest/setuptools.html#metadata +FIELDS = { + 'author_email', + 'author', + 'classifiers', + 'dependency_links', + 'description', + 'download_url', + 'extras_require', + 'install_requires', + 'keywords', + 'license_file', + 'license', + 'long_description_content_type', + 'long_description', + 'maintainer_email', + 'maintainer', + 'metadata_version', + 'name', + 'obsoletes', + 'package_dir', + 'platforms', + 'project_urls', + 'provides', + 'python_requires', + 'requires', + 'setup_requires', + 'tests_require', + 'url', + 'version', +} + + +def is_setup_call(element): + """ + Return if the AST ``element`` is a call to the setup() function. + Note: this is derived from the code in packagedcode.pypi.py + """ + if ( + isinstance(element, ast.Call) + and ( + hasattr(element, 'func') + and isinstance(element.func, ast.Name) + and getattr(element.func, 'id', None) == 'setup' + ) or ( + hasattr(element, 'func') + and isinstance(element.func, ast.Attribute) + and getattr(element.func, 'attr', None) == 'setup' + and isinstance(element.func.value, ast.Name) + and getattr(element.func.value, 'id', None) == 'setuptools' + ) + ): + return True + + +def parse_setup_py(location): + """ + Return a mapping of setuptools.setup() call argument found in a setup.py + file at ``location`` or an empty mapping. + """ + path = Path(location) + tree = tuple(ast.parse(path.read_text(encoding='utf8')).body) + body = tuple(get_body(tree)) + + call = get_setup_call(tree) + result = get_call_kwargs(call, body) + + return clean_setup(result) + + +def get_body(elements): + """ + Yield the body from ``elements`` as a single iterable. + """ + for element in elements: + if isinstance(element, ast.FunctionDef): + yield from get_body(element.body) + continue + if isinstance(element, ast.If): + yield from get_body(element.body) + if isinstance(element, ast.Expr): + yield element.value + continue + yield element + + +def get_setup_call(elements): + """ + Return a setup() method call found in the ``elements`` or None. + """ + for element in get_body(elements): + if is_setup_call(element): + return element + elif isinstance(element, (ast.Assign,)): + if isinstance(element.value, ast.Call): + if is_setup_call(element.value): + return element.value + + +def node_to_value(node, body): + """ + Return the extracted and converted value of a node or None + """ + if node is None: + return + if hasattr(ast, 'Constant'): + if isinstance(node, ast.Constant): + return node.value + + if isinstance(node, ast.Str): + return node.s + + if isinstance(node, ast.Num): + return node.n + + if isinstance(node, (ast.List, ast.Tuple, ast.Set,)): + return [node_to_value(subnode, body) for subnode in node.elts] + + if isinstance(node, ast.Dict): + result = {} + for key, value in zip(node.keys, node.values): + result[node_to_value(key, body)] = node_to_value(value, body) + return result + + if isinstance(node, ast.Name): + variable = find_variable_in_body(body, node.id) + if variable is not None: + return node_to_value(variable, body) + + if isinstance(node, ast.Call): + if not isinstance(node.func, ast.Name): + return + if node.func.id != 'dict': + return + return get_call_kwargs(node, body) + return + + +def find_variable_in_body(body, name): + """ + Return the value of the variable ``name`` found in the ``body`` ast tree or None. + """ + for elem in body: + if not isinstance(elem, ast.Assign): + continue + for target in elem.targets: + if not isinstance(target, ast.Name): + continue + if target.id == name: + return elem.value + + +def get_call_kwargs(node: ast.Call, body): + """ + Return a mapping of setup() method call keyword arguments. + """ + result = {} + keywords = getattr(node, 'keywords', []) or [] + for keyword in keywords: + # dict unpacking + if keyword.arg is None: + value = node_to_value(keyword.value, body) + if isinstance(value, dict): + result.update(value) + continue + # keyword argument + value = node_to_value(keyword.value, body) + if value is None: + continue + result[keyword.arg] = value + return result + + +def clean_setup(data): + """ + Return a cleaned mapping from a setup ``data`` mapping. + """ + result = {k: v + for k, v in data.items() + if k in FIELDS + and (v and v is not False) + and str(v) != 'UNKNOWN' + } + + # split keywords in words + keywords = result.get('keywords') + if keywords and isinstance(keywords, str): + # some keywords are separated by coma, some by space or lines + if ',' in keywords: + keywords = [k.strip() for k in keywords.split(',')] + else: + keywords = keywords.split() + result['keywords'] = keywords + + return result diff --git a/src/packagedcode/pypi_setup_py.py.ABOUT b/src/packagedcode/pypi_setup_py.py.ABOUT new file mode 100644 index 00000000000..0e1ef90e8bf --- /dev/null +++ b/src/packagedcode/pypi_setup_py.py.ABOUT @@ -0,0 +1,8 @@ +about_resource: pypi_setup_py.py +name: dephell_setuptools +author: Gram (@orsinium) +author_email: gram@orsinium.dev +homepage_url: https://github.com/dephell/dephell_setuptools +license_expression: mit +package_url: pkg:github/dephell/dephell_setuptools@v.0.2.4 +notes: code heavily modified from original \ No newline at end of file diff --git a/src/packagedcode/pypi_setup_py.py.LICENSE b/src/packagedcode/pypi_setup_py.py.LICENSE new file mode 100644 index 00000000000..e64d3d41a35 --- /dev/null +++ b/src/packagedcode/pypi_setup_py.py.LICENSE @@ -0,0 +1,20 @@ +MIT License 2019 Gram + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/packagedcode/recognize.py b/src/packagedcode/recognize.py index 5a5301b1d75..c7e794ecaf6 100644 --- a/src/packagedcode/recognize.py +++ b/src/packagedcode/recognize.py @@ -16,9 +16,7 @@ from packagedcode import ALL_DATAFILE_HANDLERS from packagedcode import models -SCANCODE_DEBUG_PACKAGE_API = os.environ.get('SCANCODE_DEBUG_PACKAGE_API', False) - -TRACE = False or SCANCODE_DEBUG_PACKAGE_API +TRACE = False or os.environ.get('SCANCODE_DEBUG_PACKAGE_API', False) def logger_debug(*args): @@ -100,9 +98,9 @@ def _parse( primary_language=handler.default_primary_language, ) if TRACE: - logger_debug('_parse: NotImplementedError: parsed', parsed) + logger_debug('_parse: NotImplementedError: handler', handler) yield pkg - if SCANCODE_DEBUG_PACKAGE_API: + if TRACE: raise diff --git a/tests/packagedcode/data/build_gradle/end2end/build.gradle b/tests/packagedcode/data/build_gradle/end2end/build.gradle new file mode 100644 index 00000000000..10414115f3c --- /dev/null +++ b/tests/packagedcode/data/build_gradle/end2end/build.gradle @@ -0,0 +1,16 @@ +dependencies { + // DEPENDENCY-5: not yet detected + api dependencies.lombok + + // DEPENDENCY-4 + api group: 'com.google', name: 'guava', version: '1.0' + + // DEPENDENCY-4 + usageDependencies group: 'org.apache', name: 'commons', version: '1.0' + + // DEPENDENCY-1 + runtimeOnly( + [group: 'org.jacoco', name: 'org.jacoco.ant', version: '0.7.4.201502262128', classifier: "nodeps", transitive: false], + [group: 'org.jacoco', name: 'org.jacoco.agent', version: '0.7.4.201502262128', classifier: "runtime", transitive: false] + ) +} diff --git a/tests/packagedcode/data/build_gradle/end2end-expected.json b/tests/packagedcode/data/build_gradle/end2end/build.gradle-expected.json similarity index 94% rename from tests/packagedcode/data/build_gradle/end2end-expected.json rename to tests/packagedcode/data/build_gradle/end2end/build.gradle-expected.json index d0bf3729b5f..721a3bcf80e 100644 --- a/tests/packagedcode/data/build_gradle/end2end-expected.json +++ b/tests/packagedcode/data/build_gradle/end2end/build.gradle-expected.json @@ -6,7 +6,7 @@ "scope": "api", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {}, "dependency_uid": "pkg:maven/com.google/guava@1.0?uuid=fixed-uid-done-for-testing-5642512d1758", "for_package_uid": null, @@ -19,7 +19,7 @@ "scope": "usageDependencies", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {}, "dependency_uid": "pkg:maven/org.apache/commons@1.0?uuid=fixed-uid-done-for-testing-5642512d1758", "for_package_uid": null, @@ -32,7 +32,7 @@ "scope": "", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {}, "dependency_uid": "pkg:maven/org.jacoco.ant@0.7.4.201502262128?uuid=fixed-uid-done-for-testing-5642512d1758", "for_package_uid": null, @@ -45,7 +45,7 @@ "scope": "", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {}, "dependency_uid": "pkg:maven/org.jacoco.agent@0.7.4.201502262128?uuid=fixed-uid-done-for-testing-5642512d1758", "for_package_uid": null, @@ -95,7 +95,7 @@ "scope": "api", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -104,7 +104,7 @@ "scope": "usageDependencies", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -113,7 +113,7 @@ "scope": "", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -122,7 +122,7 @@ "scope": "", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} } ], diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy-and-kotlin1/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy-and-kotlin1/build.gradle new file mode 100644 index 00000000000..6ed9652d10a --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy-and-kotlin1/build.gradle @@ -0,0 +1,26 @@ +plugins { + id 'scala' +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.scala-lang:scala-library:2.11.12' +} + +dependencies { + implementation 'commons-collections:commons-collections:3.2.2' + testImplementation 'org.scalatest:scalatest_2.11:3.0.0' + testImplementation 'junit:junit:4.13' +} + +// tag::adjust-memory[] +tasks.withType(ScalaCompile) { + scalaCompileOptions.forkOptions.with { + memoryMaximumSize = '1g' + jvmArgs = ['-XX:MaxMetaspaceSize=512m'] + } +} +// end::adjust-memory[] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy-and-kotlin1/build.gradle-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy-and-kotlin1/build.gradle-expected.json new file mode 100644 index 00000000000..5b8e6b9e111 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy-and-kotlin1/build.gradle-expected.json @@ -0,0 +1,48 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/org.scala-lang/scala-library@2.11.12", + "extracted_requirement": "2.11.12", + "scope": "implementation", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy-and-kotlin1/origin.README b/tests/packagedcode/data/build_gradle/groovy/groovy-and-kotlin1/origin.README new file mode 100644 index 00000000000..34ffe0f28bf --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy-and-kotlin1/origin.README @@ -0,0 +1,3 @@ +These two files are taken from Groovy and are essentially the same: +https://github.com/gradle/gradle/blob/d0d8706df4f115ad9c6e9127c93ec377b5959fff/subprojects/docs/src/snippets/scala/zinc/groovy/build.gradle +https://github.com/gradle/gradle/blob/d0d8706df4f115ad9c6e9127c93ec377b5959fff/subprojects/docs/src/snippets/scala/zinc/kotlin/build.gradle.kts \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy-basic/build.gradle similarity index 100% rename from tests/packagedcode/data/build_gradle/build.gradle rename to tests/packagedcode/data/build_gradle/groovy/groovy-basic/build.gradle diff --git a/tests/packagedcode/data/build_gradle/build.gradle-parse-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy-basic/build.gradle-expected.json similarity index 93% rename from tests/packagedcode/data/build_gradle/build.gradle-parse-expected.json rename to tests/packagedcode/data/build_gradle/groovy/groovy-basic/build.gradle-expected.json index 58062b83c70..2636e2746b7 100644 --- a/tests/packagedcode/data/build_gradle/build.gradle-parse-expected.json +++ b/tests/packagedcode/data/build_gradle/groovy/groovy-basic/build.gradle-expected.json @@ -35,7 +35,7 @@ "scope": "api", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -44,7 +44,7 @@ "scope": "usageDependencies", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -53,7 +53,7 @@ "scope": "", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -62,7 +62,7 @@ "scope": "", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} } ], diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy-no-parens/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy-no-parens/build.gradle new file mode 100644 index 00000000000..7af69bcbe1e --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy-no-parens/build.gradle @@ -0,0 +1,16 @@ +apply plugin: 'java' + +group 'org.ossreviewtoolkit.gradle.example' +version '1.0.0' + +repositories { + mavenCentral() +} + +dependencies { + implementation "com.fasterxml.jackson:jackson-bom:2.12.2'" + implementation" com.fasterxml.jackson.core:jackson-core" + + testImplementation 'org.junit:junit-bom:5.7.2'" + testImplementation "org.junit.platform:junit-platform-commons" +} diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy-no-parens/build.gradle-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy-no-parens/build.gradle-expected.json new file mode 100644 index 00000000000..eb32a9799b2 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy-no-parens/build.gradle-expected.json @@ -0,0 +1,48 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/com.fasterxml.jackson/jackson-bom@2.12.2%27", + "extracted_requirement": "2.12.2'", + "scope": "implementation", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/groovy1/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy1/build.gradle similarity index 100% rename from tests/packagedcode/data/build_gradle/groovy1/build.gradle rename to tests/packagedcode/data/build_gradle/groovy/groovy1/build.gradle diff --git a/tests/packagedcode/data/build_gradle/groovy1/build.gradle-parse-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy1/build.gradle-expected.json similarity index 95% rename from tests/packagedcode/data/build_gradle/groovy1/build.gradle-parse-expected.json rename to tests/packagedcode/data/build_gradle/groovy/groovy1/build.gradle-expected.json index 25216175260..90c6a06e786 100644 --- a/tests/packagedcode/data/build_gradle/groovy1/build.gradle-parse-expected.json +++ b/tests/packagedcode/data/build_gradle/groovy/groovy1/build.gradle-expected.json @@ -35,7 +35,7 @@ "scope": "compile", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -44,7 +44,7 @@ "scope": "testCompile", "is_runtime": false, "is_optional": true, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} } ], diff --git a/tests/packagedcode/data/build_gradle/groovy2/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy2/build.gradle similarity index 100% rename from tests/packagedcode/data/build_gradle/groovy2/build.gradle rename to tests/packagedcode/data/build_gradle/groovy/groovy2/build.gradle diff --git a/tests/packagedcode/data/build_gradle/groovy2/build.gradle-parse-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy2/build.gradle-expected.json similarity index 94% rename from tests/packagedcode/data/build_gradle/groovy2/build.gradle-parse-expected.json rename to tests/packagedcode/data/build_gradle/groovy/groovy2/build.gradle-expected.json index 32a90e08be1..565494a2920 100644 --- a/tests/packagedcode/data/build_gradle/groovy2/build.gradle-parse-expected.json +++ b/tests/packagedcode/data/build_gradle/groovy/groovy2/build.gradle-expected.json @@ -35,7 +35,7 @@ "scope": "api", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -44,7 +44,7 @@ "scope": "implementation", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -53,7 +53,7 @@ "scope": "testImplementation", "is_runtime": false, "is_optional": true, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} } ], diff --git a/tests/packagedcode/data/build_gradle/groovy3/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy3/build.gradle similarity index 100% rename from tests/packagedcode/data/build_gradle/groovy3/build.gradle rename to tests/packagedcode/data/build_gradle/groovy/groovy3/build.gradle diff --git a/tests/packagedcode/data/build_gradle/groovy3/build.gradle-parse-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy3/build.gradle-expected.json similarity index 92% rename from tests/packagedcode/data/build_gradle/groovy3/build.gradle-parse-expected.json rename to tests/packagedcode/data/build_gradle/groovy/groovy3/build.gradle-expected.json index 5ec0dc617b1..372f54ab544 100644 --- a/tests/packagedcode/data/build_gradle/groovy3/build.gradle-parse-expected.json +++ b/tests/packagedcode/data/build_gradle/groovy/groovy3/build.gradle-expected.json @@ -40,7 +40,7 @@ }, { "purl": "pkg:maven/com.fasterxml.jackson.core/jackson-core", - "extracted_requirement": null, + "extracted_requirement": "", "scope": "implementation", "is_runtime": true, "is_optional": false, @@ -51,14 +51,14 @@ "purl": "pkg:maven/org.junit/junit-bom@5.7.2", "extracted_requirement": "5.7.2", "scope": "platform", - "is_runtime": false, - "is_optional": true, + "is_runtime": true, + "is_optional": false, "is_resolved": true, "resolved_package": {} - } + }, { "purl": "pkg:maven/org.junit.platform/junit-platform-commons", - "extracted_requirement": null, + "extracted_requirement": "", "scope": "testImplementation", "is_runtime": false, "is_optional": true, diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy4-singlequotes/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy4-singlequotes/build.gradle new file mode 100644 index 00000000000..774ac262238 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy4-singlequotes/build.gradle @@ -0,0 +1,19 @@ +apply plugin: 'java' + +group 'org.ossreviewtoolkit.gradle.example' +version '1.0.0' + +repositories { + mavenCentral() +} + +dependencies { + implementation(enforcedPlatform('com.fasterxml.jackson:jackson-bom:2.12.2')) + implementation('com.fasterxml.jackson.core:jackson-core') + + testImplementation(platform('org.junit:junit-bom:5.7.2')) + testImplementation('org.junit.platform:junit-platform-commons') + compile('com.fasterxml.jackson.core:jackson-core') +} + +logger.quiet("The current working directory is set to: " + System.properties['user.dir']) diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy4-singlequotes/build.gradle-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy4-singlequotes/build.gradle-expected.json new file mode 100644 index 00000000000..10cc30951ba --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy4-singlequotes/build.gradle-expected.json @@ -0,0 +1,84 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/com.fasterxml.jackson/jackson-bom@2.12.2", + "extracted_requirement": "2.12.2", + "scope": "enforcedPlatform", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/com.fasterxml.jackson.core/jackson-core", + "extracted_requirement": "", + "scope": "implementation", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.junit/junit-bom@5.7.2", + "extracted_requirement": "5.7.2", + "scope": "platform", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.junit.platform/junit-platform-commons", + "extracted_requirement": "", + "scope": "testImplementation", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:maven/com.fasterxml.jackson.core/jackson-core", + "extracted_requirement": "", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy4/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy4/build.gradle new file mode 100644 index 00000000000..5bd1bed4294 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy4/build.gradle @@ -0,0 +1,24 @@ + + +dependencies { + runtimeOnly group: 'org.springframework', name: 'spring-core', version: '2.5' + runtimeOnly 'org.springframework:spring-core:2.5', + 'org.springframework:spring-aop:2.5' + runtimeOnly( + [group: 'org.springframework', name: 'spring-core', version: '2.5'], + [group: 'org.springframework', name: 'spring-aop', version: '2.5'] + ) + runtimeOnly('org.hibernate:hibernate:3.0.5') { + transitive = true + } + runtimeOnly group: 'org.hibernate', name: 'hibernate', version: '3.0.5', transitive: true + runtimeOnly(group: 'org.hibernate', name: 'hibernate', version: '3.0.5') { + transitive = true + } + + testImplementation 'junit:junit:4.13' + smokeTest 'org.apache.httpcomponents:httpclient:4.5.5' + jasper 'org.apache.tomcat.embed:tomcat-embed-jasper:9.0.2' + +} + diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy4/build.gradle-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy4/build.gradle-expected.json new file mode 100644 index 00000000000..db4909807cf --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy4/build.gradle-expected.json @@ -0,0 +1,120 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/org.springframework/spring-core@2.5", + "extracted_requirement": "2.5", + "scope": "runtimeOnly", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.springframework/spring-core@2.5", + "extracted_requirement": "2.5", + "scope": "", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.springframework/spring-aop@2.5", + "extracted_requirement": "2.5", + "scope": "", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.hibernate/hibernate@3.0.5", + "extracted_requirement": "3.0.5", + "scope": "runtimeOnly", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.hibernate/hibernate@3.0.5", + "extracted_requirement": "3.0.5", + "scope": "runtimeOnly", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.hibernate/hibernate@3.0.5", + "extracted_requirement": "3.0.5", + "scope": "", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/junit/junit@4.13", + "extracted_requirement": "4.13", + "scope": "testImplementation", + "is_runtime": false, + "is_optional": true, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.apache.httpcomponents/httpclient@4.5.5", + "extracted_requirement": "4.5.5", + "scope": "smokeTest", + "is_runtime": false, + "is_optional": true, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.apache.tomcat.embed/tomcat-embed-jasper@9.0.2", + "extracted_requirement": "9.0.2", + "scope": "jasper", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy5-parens+singlequotes/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy5-parens+singlequotes/build.gradle new file mode 100644 index 00000000000..d90df278403 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy5-parens+singlequotes/build.gradle @@ -0,0 +1,13 @@ +apply plugin: 'java' + +group 'org.foobar.gradle.example' +version '1.0.0' + +repositories { + mavenCentral() +} + +dependencies { + implementation(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.12.2")) + compile('com.fasterxml.jackson.core:jackson-core') +} diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy5-parens+singlequotes/build.gradle-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy5-parens+singlequotes/build.gradle-expected.json new file mode 100644 index 00000000000..1223c365d21 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy5-parens+singlequotes/build.gradle-expected.json @@ -0,0 +1,57 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/com.fasterxml.jackson/jackson-bom@2.12.2", + "extracted_requirement": "2.12.2", + "scope": "enforcedPlatform", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/com.fasterxml.jackson.core/jackson-core", + "extracted_requirement": "", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy5/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy5/build.gradle new file mode 100644 index 00000000000..ca40f047e70 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy5/build.gradle @@ -0,0 +1,22 @@ + + +repositories { + ivy { + url 'https://ajax.googleapis.com/ajax/libs' + patternLayout { + artifact '[organization]/[revision]/[module].[ext]' + } + metadataSources { + artifact() + } + } +} + +configurations { + js +} + +dependencies { + js 'jquery:jquery:3.2.1@js' +} + diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy5/build.gradle-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy5/build.gradle-expected.json new file mode 100644 index 00000000000..ef2cdff501a --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy5/build.gradle-expected.json @@ -0,0 +1,48 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/jquery/jquery@3.2.1%40js", + "extracted_requirement": "3.2.1@js", + "scope": "js", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy6-braces/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy6-braces/build.gradle new file mode 100644 index 00000000000..5de9b85d639 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy6-braces/build.gradle @@ -0,0 +1,5 @@ +dependencies { + + compile 'junit:junit:4.13.1', { force = true } +} + diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy6-braces/build.gradle-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy6-braces/build.gradle-expected.json new file mode 100644 index 00000000000..51cc0800459 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy6-braces/build.gradle-expected.json @@ -0,0 +1,38 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy6-with-props/build.gradle b/tests/packagedcode/data/build_gradle/groovy/groovy6-with-props/build.gradle new file mode 100644 index 00000000000..d8ad5a15a64 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy6-with-props/build.gradle @@ -0,0 +1,55 @@ +// from https://github.com/mesosphere-backup/dcos-cassandra-service/blob/76ee3af18cb04eae28dc0edeba9ac8d8bfff2216/cassandra-executor/build.gradle +apply plugin: 'application' +apply plugin: 'maven-publish' +mainClassName = 'com.mesosphere.dcos.cassandra.executor.Main' + +ext { + junitVer = '4.12' + datastaxVer = '3.1.0' + awsVer = '1.11.49' +} + +dependencies { + compile project(':cassandra-commons') + compile ('com.google.guava:guava:18.0'){force = true} + compile 'org.apache.cassandra:cassandra-all:3.0.9' + compile 'org.apache.commons:commons-compress:1.5' + compile ("com.amazonaws:aws-java-sdk-core:${awsVer}"){force = true} + compile "com.amazonaws:aws-java-sdk:${awsVer}" + compile "com.microsoft.azure:azure-storage:4.2.0" + compile "commons-io:commons-io:2.5" + compile "com.datastax.cassandra:cassandra-driver-core:${datastaxVer}" + + compile 'org.xerial.snappy:snappy-java:1.1.2.1' + // To override the junit compile dependency that cassandra brings in. + compile "junit:junit:${junitVer}" + testCompile "junit:junit:${junitVer}" +} + +def projectVersion = project.version +distributions { + main { + baseName = 'executor' + version = '' + } +} + +publishing { + publications { + maven(MavenPublication) { + artifact("$buildDir/distributions/executor.zip") { + extension 'zip' + version = projectVersion + } + } + } +} + +publishing { + repositories { + maven parent.mavenRep + } +} + +publishToMavenLocal.dependsOn(build) +publish.dependsOn(build) \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/groovy/groovy6-with-props/build.gradle-expected.json b/tests/packagedcode/data/build_gradle/groovy/groovy6-with-props/build.gradle-expected.json new file mode 100644 index 00000000000..000772aaf95 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/groovy/groovy6-with-props/build.gradle-expected.json @@ -0,0 +1,147 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/cassandra-commons", + "extracted_requirement": "", + "scope": "project", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:maven/com.google.guava/guava@18.0", + "extracted_requirement": "18.0", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.apache.cassandra/cassandra-all@3.0.9", + "extracted_requirement": "3.0.9", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.apache.commons/commons-compress@1.5", + "extracted_requirement": "1.5", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/com.amazonaws/aws-java-sdk-core@%24%7BawsVer%7D", + "extracted_requirement": "${awsVer}", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/com.amazonaws/aws-java-sdk@%24%7BawsVer%7D", + "extracted_requirement": "${awsVer}", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/com.microsoft.azure/azure-storage@4.2.0", + "extracted_requirement": "4.2.0", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/commons-io/commons-io@2.5", + "extracted_requirement": "2.5", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/com.datastax.cassandra/cassandra-driver-core@%24%7BdatastaxVer%7D", + "extracted_requirement": "${datastaxVer}", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.xerial.snappy/snappy-java@1.1.2.1", + "extracted_requirement": "1.1.2.1", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/junit/junit@%24%7BjunitVer%7D", + "extracted_requirement": "${junitVer}", + "scope": "compile", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/junit/junit@%24%7BjunitVer%7D", + "extracted_requirement": "${junitVer}", + "scope": "testCompile", + "is_runtime": false, + "is_optional": true, + "is_resolved": true, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/kotlin/groovy-and-kotlin2/build.gradle.kts b/tests/packagedcode/data/build_gradle/kotlin/groovy-and-kotlin2/build.gradle.kts new file mode 100644 index 00000000000..50756f6a80a --- /dev/null +++ b/tests/packagedcode/data/build_gradle/kotlin/groovy-and-kotlin2/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + scala +} + +repositories { + mavenCentral() +} + +dependencies { + implementation("org.scala-lang:scala-library:2.11.12") +} + +dependencies { + implementation("commons-collections:commons-collections:3.2.2") + testImplementation("org.scalatest:scalatest_2.11:3.0.0") + testImplementation("junit:junit:4.13") +} + +// tag::adjust-memory[] +tasks.withType<ScalaCompile>().configureEach { + scalaCompileOptions.forkOptions.apply { + memoryMaximumSize = "1g" + jvmArgs = listOf("-XX:MaxMetaspaceSize=512m") + } +} +// end::adjust-memory[] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/kotlin/groovy-and-kotlin2/build.gradle.kts-expected.json b/tests/packagedcode/data/build_gradle/kotlin/groovy-and-kotlin2/build.gradle.kts-expected.json new file mode 100644 index 00000000000..5b8e6b9e111 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/kotlin/groovy-and-kotlin2/build.gradle.kts-expected.json @@ -0,0 +1,48 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/org.scala-lang/scala-library@2.11.12", + "extracted_requirement": "2.11.12", + "scope": "implementation", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/kotlin/groovy-and-kotlin2/origin.README b/tests/packagedcode/data/build_gradle/kotlin/groovy-and-kotlin2/origin.README new file mode 100644 index 00000000000..34ffe0f28bf --- /dev/null +++ b/tests/packagedcode/data/build_gradle/kotlin/groovy-and-kotlin2/origin.README @@ -0,0 +1,3 @@ +These two files are taken from Groovy and are essentially the same: +https://github.com/gradle/gradle/blob/d0d8706df4f115ad9c6e9127c93ec377b5959fff/subprojects/docs/src/snippets/scala/zinc/groovy/build.gradle +https://github.com/gradle/gradle/blob/d0d8706df4f115ad9c6e9127c93ec377b5959fff/subprojects/docs/src/snippets/scala/zinc/kotlin/build.gradle.kts \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/kotlin1/build.gradle.kts b/tests/packagedcode/data/build_gradle/kotlin/kotlin1/build.gradle.kts similarity index 100% rename from tests/packagedcode/data/build_gradle/kotlin1/build.gradle.kts rename to tests/packagedcode/data/build_gradle/kotlin/kotlin1/build.gradle.kts diff --git a/tests/packagedcode/data/build_gradle/kotlin1/build.gradle.kts-parse-expected.json b/tests/packagedcode/data/build_gradle/kotlin/kotlin1/build.gradle.kts-expected.json similarity index 95% rename from tests/packagedcode/data/build_gradle/kotlin1/build.gradle.kts-parse-expected.json rename to tests/packagedcode/data/build_gradle/kotlin/kotlin1/build.gradle.kts-expected.json index dfd821750ba..64834db951c 100644 --- a/tests/packagedcode/data/build_gradle/kotlin1/build.gradle.kts-parse-expected.json +++ b/tests/packagedcode/data/build_gradle/kotlin/kotlin1/build.gradle.kts-expected.json @@ -35,7 +35,7 @@ "scope": "classpath", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} }, { @@ -44,7 +44,7 @@ "scope": "classpath", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} } ], diff --git a/tests/packagedcode/data/build_gradle/kotlin2/build.gradle.kts b/tests/packagedcode/data/build_gradle/kotlin/kotlin2/build.gradle.kts similarity index 100% rename from tests/packagedcode/data/build_gradle/kotlin2/build.gradle.kts rename to tests/packagedcode/data/build_gradle/kotlin/kotlin2/build.gradle.kts diff --git a/tests/packagedcode/data/build_gradle/kotlin2/build.gradle.kts-parse-expected.json b/tests/packagedcode/data/build_gradle/kotlin/kotlin2/build.gradle.kts-expected.json similarity index 97% rename from tests/packagedcode/data/build_gradle/kotlin2/build.gradle.kts-parse-expected.json rename to tests/packagedcode/data/build_gradle/kotlin/kotlin2/build.gradle.kts-expected.json index 821b8bb4570..c17ec775d87 100644 --- a/tests/packagedcode/data/build_gradle/kotlin2/build.gradle.kts-parse-expected.json +++ b/tests/packagedcode/data/build_gradle/kotlin/kotlin2/build.gradle.kts-expected.json @@ -35,7 +35,7 @@ "scope": "classpath", "is_runtime": true, "is_optional": false, - "is_resolved": false, + "is_resolved": true, "resolved_package": {} } ], diff --git a/tests/packagedcode/data/build_gradle/kotlin/kotlin3/build.gradle.kts b/tests/packagedcode/data/build_gradle/kotlin/kotlin3/build.gradle.kts new file mode 100644 index 00000000000..c82602f5838 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/kotlin/kotlin3/build.gradle.kts @@ -0,0 +1,20 @@ +// from https://raw.githubusercontent.com/gradle/gradle/master/build-logic/packaging/build.gradle.kts +plugins { + id("gradlebuild.build-logic.kotlin-dsl-gradle-plugin") +} + +description = "Provides a plugin for building Gradle distributions" + +dependencies { + implementation(project(":documentation")) { + // TODO turn this around: move corresponding code to this project and let docs depend on it + because("API metadata generation is part of the DSL guide") + } + implementation(project(":basics")) + implementation(project(":module-identity")) + implementation(project(":jvm")) + + implementation("com.google.code.gson:gson") + + testImplementation("org.junit.jupiter:junit-jupiter") +} diff --git a/tests/packagedcode/data/build_gradle/kotlin/kotlin3/build.gradle.kts-expected.json b/tests/packagedcode/data/build_gradle/kotlin/kotlin3/build.gradle.kts-expected.json new file mode 100644 index 00000000000..a029c2c2d81 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/kotlin/kotlin3/build.gradle.kts-expected.json @@ -0,0 +1,93 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/documentation", + "extracted_requirement": "", + "scope": "project", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:maven/basics", + "extracted_requirement": "", + "scope": "project", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:maven/module-identity", + "extracted_requirement": "", + "scope": "project", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:maven/jvm", + "extracted_requirement": "", + "scope": "project", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:maven/com.google.code.gson/gson", + "extracted_requirement": "", + "scope": "implementation", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.junit.jupiter/junit-jupiter", + "extracted_requirement": "", + "scope": "testImplementation", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/kotlin/kotlin4/build.gradle.kts b/tests/packagedcode/data/build_gradle/kotlin/kotlin4/build.gradle.kts new file mode 100644 index 00000000000..a734a7251eb --- /dev/null +++ b/tests/packagedcode/data/build_gradle/kotlin/kotlin4/build.gradle.kts @@ -0,0 +1,13 @@ + + +dependencies { + runtimeOnly(group = "org.springframework", name = "spring-core", version = "2.5") + runtimeOnly("org.springframework:spring-aop:2.5") + runtimeOnly("org.hibernate:hibernate:3.0.5") { + isTransitive = true + } + runtimeOnly(group = "org.hibernate", name = "hibernate", version = "3.0.5") { + isTransitive = true + } +} + diff --git a/tests/packagedcode/data/build_gradle/kotlin/kotlin4/build.gradle.kts-expected.json b/tests/packagedcode/data/build_gradle/kotlin/kotlin4/build.gradle.kts-expected.json new file mode 100644 index 00000000000..1f835ddf7c5 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/kotlin/kotlin4/build.gradle.kts-expected.json @@ -0,0 +1,57 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:maven/org.springframework/spring-aop@2.5", + "extracted_requirement": "2.5", + "scope": "runtimeOnly", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:maven/org.hibernate/hibernate@3.0.5", + "extracted_requirement": "3.0.5", + "scope": "runtimeOnly", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/build_gradle/kotlin/kotlin5/build.gradle.kts b/tests/packagedcode/data/build_gradle/kotlin/kotlin5/build.gradle.kts new file mode 100644 index 00000000000..de860670e25 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/kotlin/kotlin5/build.gradle.kts @@ -0,0 +1,22 @@ + + +repositories { + ivy { + url = uri("https://ajax.googleapis.com/ajax/libs") + patternLayout { + artifact("[organization]/[revision]/[module].[ext]") + } + metadataSources { + artifact() + } + } +} + +configurations { + create("js") +} + +dependencies { + "js"("jquery:jquery:3.2.1@js") +} + diff --git a/tests/packagedcode/data/build_gradle/kotlin/kotlin5/build.gradle.kts-expected.json b/tests/packagedcode/data/build_gradle/kotlin/kotlin5/build.gradle.kts-expected.json new file mode 100644 index 00000000000..51cc0800459 --- /dev/null +++ b/tests/packagedcode/data/build_gradle/kotlin/kotlin5/build.gradle.kts-expected.json @@ -0,0 +1,38 @@ +[ + { + "type": "maven", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "build_gradle", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/instance/python-package-instance-expected-with-test-manifests.json b/tests/packagedcode/data/instance/python-package-instance-expected-with-test-manifests.json index c917673da96..7f4fcf8f1c2 100644 --- a/tests/packagedcode/data/instance/python-package-instance-expected-with-test-manifests.json +++ b/tests/packagedcode/data/instance/python-package-instance-expected-with-test-manifests.json @@ -51,7 +51,7 @@ "notice_text": null, "source_packages": [], "extra_data": { - "Documentation": "Documentation, https://setuptools.readthedocs.io/" + "Documentation": "https://setuptools.readthedocs.io/" }, "repository_homepage_url": "https://pypi.org/project/setuptools", "repository_download_url": "https://pypi.org/packages/source/s/setuptools/setuptools-58.2.0.tar.gz", @@ -140,7 +140,7 @@ "source_packages": [], "file_references": [], "extra_data": { - "Documentation": "Documentation, https://setuptools.readthedocs.io/" + "Documentation": "https://setuptools.readthedocs.io/" }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/setuptools", diff --git a/tests/packagedcode/data/plugin/python-package-expected.json b/tests/packagedcode/data/plugin/python-package-expected.json index 8dfc3f79515..de4a95dbe49 100644 --- a/tests/packagedcode/data/plugin/python-package-expected.json +++ b/tests/packagedcode/data/plugin/python-package-expected.json @@ -277,7 +277,7 @@ "type": "person", "role": "author", "name": "Stanis\u0142aw Pitucha", - "email": null, + "email": "viraptor@gmail.com", "url": null } ], @@ -745,7 +745,7 @@ "type": "person", "role": "author", "name": "Stanis\u0142aw Pitucha", - "email": null, + "email": "viraptor@gmail.com", "url": null } ], diff --git a/tests/packagedcode/data/pypi/metadata/PKG-INFO-expected.json b/tests/packagedcode/data/pypi/metadata/PKG-INFO-expected.json index 9a403b9a93b..2e9c0413aca 100644 --- a/tests/packagedcode/data/pypi/metadata/PKG-INFO-expected.json +++ b/tests/packagedcode/data/pypi/metadata/PKG-INFO-expected.json @@ -37,7 +37,7 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": "https://github.com/dbtsai/python-mimeparse/tarball/1.6.0", + "vcs_url": null, "copyright": null, "license_expression": "mit", "declared_license": { @@ -48,7 +48,9 @@ "notice_text": null, "source_packages": [], "file_references": [], - "extra_data": {}, + "extra_data": { + "Download-URL": "https://github.com/dbtsai/python-mimeparse/tarball/1.6.0" + }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/python-mimeparse", "repository_download_url": "https://pypi.org/packages/source/p/python-mimeparse/python-mimeparse-1.6.0.tar.gz", diff --git a/tests/packagedcode/data/pypi/metadata/v11/PKG-INFO-expected.json b/tests/packagedcode/data/pypi/metadata/v11/PKG-INFO-expected.json index 9a403b9a93b..2e9c0413aca 100644 --- a/tests/packagedcode/data/pypi/metadata/v11/PKG-INFO-expected.json +++ b/tests/packagedcode/data/pypi/metadata/v11/PKG-INFO-expected.json @@ -37,7 +37,7 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": "https://github.com/dbtsai/python-mimeparse/tarball/1.6.0", + "vcs_url": null, "copyright": null, "license_expression": "mit", "declared_license": { @@ -48,7 +48,9 @@ "notice_text": null, "source_packages": [], "file_references": [], - "extra_data": {}, + "extra_data": { + "Download-URL": "https://github.com/dbtsai/python-mimeparse/tarball/1.6.0" + }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/python-mimeparse", "repository_download_url": "https://pypi.org/packages/source/p/python-mimeparse/python-mimeparse-1.6.0.tar.gz", diff --git a/tests/packagedcode/data/pypi/metadata/v12/PKG-INFO-expected.json b/tests/packagedcode/data/pypi/metadata/v12/PKG-INFO-expected.json index d7ae7c24747..3810e797706 100644 --- a/tests/packagedcode/data/pypi/metadata/v12/PKG-INFO-expected.json +++ b/tests/packagedcode/data/pypi/metadata/v12/PKG-INFO-expected.json @@ -49,7 +49,7 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": "https://pypi.python.org/pypi/pyldap/", + "vcs_url": null, "copyright": null, "license_expression": "python AND python", "declared_license": { @@ -61,7 +61,9 @@ "notice_text": null, "source_packages": [], "file_references": [], - "extra_data": {}, + "extra_data": { + "Download-URL": "https://pypi.python.org/pypi/pyldap/" + }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/pyldap", "repository_download_url": "https://pypi.org/packages/source/p/pyldap/pyldap-2.4.45.tar.gz", diff --git a/tests/packagedcode/data/pypi/metadata/v21/PKG-INFO-expected.json b/tests/packagedcode/data/pypi/metadata/v21/PKG-INFO-expected.json index 1b05665d0b7..3761891ee29 100644 --- a/tests/packagedcode/data/pypi/metadata/v21/PKG-INFO-expected.json +++ b/tests/packagedcode/data/pypi/metadata/v21/PKG-INFO-expected.json @@ -40,8 +40,8 @@ "md5": null, "sha256": null, "sha512": null, - "bug_tracking_url": "Bug Tracker, https://bugs.launchpad.net/pbr/", - "code_view_url": "Source Code, https://git.openstack.org/cgit/openstack-dev/pbr/", + "bug_tracking_url": "https://bugs.launchpad.net/pbr/", + "code_view_url": "https://git.openstack.org/cgit/openstack-dev/pbr/", "vcs_url": null, "copyright": null, "license_expression": "apache-2.0", @@ -54,7 +54,7 @@ "source_packages": [], "file_references": [], "extra_data": { - "Documentation": "Documentation, https://docs.openstack.org/pbr/" + "Documentation": "https://docs.openstack.org/pbr/" }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/pbr", diff --git a/tests/packagedcode/data/pypi/more_setup.py.ABOUT b/tests/packagedcode/data/pypi/more_setup.py.ABOUT new file mode 100644 index 00000000000..217f79dc69b --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py.ABOUT @@ -0,0 +1,8 @@ +about_resource: more_setup.py +name: dephell_setuptools +author: Gram (@orsinium) +author_email: gram@orsinium.dev +homepage_url: https://github.com/dephell/dephell_setuptools +license_expression: mit +package_url: pkg:github/dephell/dephell_setuptools@v.0.2.4 +notes: test files copied from dephell/dephell_setuptools \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py.LICENSE b/tests/packagedcode/data/pypi/more_setup.py.LICENSE new file mode 100644 index 00000000000..e64d3d41a35 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py.LICENSE @@ -0,0 +1,20 @@ +MIT License 2019 Gram + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tests/packagedcode/data/pypi/more_setup.py/ansible/.eggs/README.txt b/tests/packagedcode/data/pypi/more_setup.py/ansible/.eggs/README.txt new file mode 100644 index 00000000000..5d01668824f --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/ansible/.eggs/README.txt @@ -0,0 +1,6 @@ +This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins. + +This directory caches those eggs to prevent repeated downloads. + +However, it is safe to delete this directory. + diff --git a/tests/packagedcode/data/pypi/more_setup.py/ansible/README.rst b/tests/packagedcode/data/pypi/more_setup.py/ansible/README.rst new file mode 100644 index 00000000000..3ef2d56ca86 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/ansible/README.rst @@ -0,0 +1 @@ +a lot of text diff --git a/tests/packagedcode/data/pypi/more_setup.py/ansible/ansible/release.py b/tests/packagedcode/data/pypi/more_setup.py/ansible/ansible/release.py new file mode 100644 index 00000000000..f95c639ee6b --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/ansible/ansible/release.py @@ -0,0 +1,3 @@ +__version__ = '2.10.0.dev0' +__author__ = 'Ansible, Inc.' +__codename__ = 'When the Levee Breaks' diff --git a/tests/packagedcode/data/pypi/more_setup.py/ansible/packaging/requirements/requirements-azure.txt b/tests/packagedcode/data/pypi/more_setup.py/ansible/packaging/requirements/requirements-azure.txt new file mode 100644 index 00000000000..9cc65602566 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/ansible/packaging/requirements/requirements-azure.txt @@ -0,0 +1,4 @@ +packaging +requests[security] +xmltodict +azure-cli-core==2.0.35 diff --git a/tests/packagedcode/data/pypi/more_setup.py/ansible/requirements.txt b/tests/packagedcode/data/pypi/more_setup.py/ansible/requirements.txt new file mode 100644 index 00000000000..09ba9fc6f06 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/ansible/requirements.txt @@ -0,0 +1,10 @@ +# Note: this requirements.txt file is used to specify what dependencies are +# needed to make the package run rather than for deployment of a tested set of +# packages. Thus, this should be the loosest set possible (only required +# packages, not optional ones, and with the widest range of versions that could +# be suitable) +jinja2 +PyYAML +paramiko +cryptography +setuptools diff --git a/tests/packagedcode/data/pypi/more_setup.py/ansible/setup.py b/tests/packagedcode/data/pypi/more_setup.py/ansible/setup.py new file mode 100644 index 00000000000..5d7d1f4ec60 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/ansible/setup.py @@ -0,0 +1,323 @@ +from __future__ import print_function + +import json +import os +import os.path +import re +import sys +import warnings + +from collections import defaultdict +from distutils.command.build_scripts import build_scripts as BuildScripts +from distutils.command.sdist import sdist as SDist + +try: + from setuptools import setup, find_packages + from setuptools.command.build_py import build_py as BuildPy + from setuptools.command.install_lib import install_lib as InstallLib + from setuptools.command.install_scripts import install_scripts as InstallScripts +except ImportError: + print( + "Ansible now needs setuptools in order to build. Install it using" + " your package manager (usually python-setuptools) or via pip (pip" + " install setuptools).", + file=sys.stderr, + ) + sys.exit(1) + +sys.path.insert(0, os.path.abspath("lib")) +from ansible.release import __version__, __author__ + + +SYMLINK_CACHE = "SYMLINK_CACHE.json" + + +def _find_symlinks(topdir, extension=""): + """Find symlinks that should be maintained + + Maintained symlinks exist in the bin dir or are modules which have + aliases. Our heuristic is that they are a link in a certain path which + point to a file in the same directory. + """ + symlinks = defaultdict(list) + for base_path, dirs, files in os.walk(topdir): + for filename in files: + filepath = os.path.join(base_path, filename) + if os.path.islink(filepath) and filename.endswith(extension): + target = os.readlink(filepath) + if os.path.dirname(target) == "": + link = filepath[len(topdir) :] + if link.startswith("/"): + link = link[1:] + symlinks[os.path.basename(target)].append(link) + return symlinks + + +def _cache_symlinks(symlink_data): + with open(SYMLINK_CACHE, "w") as f: + json.dump(symlink_data, f) + + +def _maintain_symlinks(symlink_type, base_path): + """Switch a real file into a symlink""" + try: + # Try the cache first because going from git checkout to sdist is the + # only time we know that we're going to cache correctly + with open(SYMLINK_CACHE, "r") as f: + symlink_data = json.load(f) + except (IOError, OSError) as e: + # IOError on py2, OSError on py3. Both have errno + if e.errno == 2: + # SYMLINKS_CACHE doesn't exist. Fallback to trying to create the + # cache now. Will work if we're running directly from a git + # checkout or from an sdist created earlier. + symlink_data = { + "script": _find_symlinks("bin"), + "library": _find_symlinks("lib", ".py"), + } + + # Sanity check that something we know should be a symlink was + # found. We'll take that to mean that the current directory + # structure properly reflects symlinks in the git repo + if "ansible-playbook" in symlink_data["script"]["ansible"]: + _cache_symlinks(symlink_data) + else: + raise + else: + raise + symlinks = symlink_data[symlink_type] + + for source in symlinks: + for dest in symlinks[source]: + dest_path = os.path.join(base_path, dest) + if not os.path.islink(dest_path): + try: + os.unlink(dest_path) + except OSError as e: + if e.errno == 2: + # File does not exist which is all we wanted + pass + os.symlink(source, dest_path) + + +class BuildPyCommand(BuildPy): + def run(self): + BuildPy.run(self) + _maintain_symlinks("library", self.build_lib) + + +class BuildScriptsCommand(BuildScripts): + def run(self): + BuildScripts.run(self) + _maintain_symlinks("script", self.build_dir) + + +class InstallLibCommand(InstallLib): + def run(self): + InstallLib.run(self) + _maintain_symlinks("library", self.install_dir) + + +class InstallScriptsCommand(InstallScripts): + def run(self): + InstallScripts.run(self) + _maintain_symlinks("script", self.install_dir) + + +class SDistCommand(SDist): + def run(self): + # have to generate the cache of symlinks for release as sdist is the + # only command that has access to symlinks from the git repo + symlinks = { + "script": _find_symlinks("bin"), + "library": _find_symlinks("lib", ".py"), + } + _cache_symlinks(symlinks) + + SDist.run(self) + + +def read_file(file_name): + """Read file and return its contents.""" + with open(file_name, "r") as f: + return f.read() + + +def read_requirements(file_name): + """Read requirements file as a list.""" + reqs = read_file(file_name).splitlines() + if not reqs: + raise RuntimeError( + "Unable to read requirements from the %s file" + "That indicates this copy of the source code is incomplete." % file_name + ) + return reqs + + +PYCRYPTO_DIST = "pycrypto" + + +def get_crypto_req(): + """Detect custom crypto from ANSIBLE_CRYPTO_BACKEND env var. + + pycrypto or cryptography. We choose a default but allow the user to + override it. This translates into pip install of the sdist deciding what + package to install and also the runtime dependencies that pkg_resources + knows about. + """ + crypto_backend = os.environ.get("ANSIBLE_CRYPTO_BACKEND", "").strip() + + if crypto_backend == PYCRYPTO_DIST: + # Attempt to set version requirements + return "%s >= 2.6" % PYCRYPTO_DIST + + return crypto_backend or None + + +def substitute_crypto_to_req(req): + """Replace crypto requirements if customized.""" + crypto_backend = get_crypto_req() + + if crypto_backend is None: + return req + + def is_not_crypto(r): + CRYPTO_LIBS = PYCRYPTO_DIST, "cryptography" + return not any(r.lower().startswith(c) for c in CRYPTO_LIBS) + + return [r for r in req if is_not_crypto(r)] + [crypto_backend] + + +def read_extras(): + """Specify any extra requirements for installation.""" + extras = dict() + extra_requirements_dir = "packaging/requirements" + for extra_requirements_filename in os.listdir(extra_requirements_dir): + filename_match = re.search( + r"^requirements-(\w*).txt$", extra_requirements_filename + ) + if not filename_match: + continue + extra_req_file_path = os.path.join( + extra_requirements_dir, extra_requirements_filename + ) + try: + extras[filename_match.group(1)] = read_file( + extra_req_file_path + ).splitlines() + except RuntimeError: + pass + return extras + + +def get_dynamic_setup_params(): + """Add dynamically calculated setup params to static ones.""" + return { + # Retrieve the long description from the README + "long_description": read_file("README.rst"), + "install_requires": substitute_crypto_to_req( + read_requirements("requirements.txt") + ), + "extras_require": read_extras(), + } + + +static_setup_params = dict( + # Use the distutils SDist so that symlinks are not expanded + # Use a custom Build for the same reason + cmdclass={ + "build_py": BuildPyCommand, + "build_scripts": BuildScriptsCommand, + "install_lib": InstallLibCommand, + "install_scripts": InstallScriptsCommand, + "sdist": SDistCommand, + }, + name="ansible", + version=__version__, + description="Radically simple IT automation", + author=__author__, + author_email="info@ansible.com", + url="https://ansible.com/", + project_urls={ + "Bug Tracker": "https://github.com/ansible/ansible/issues", + "CI: Shippable": "https://app.shippable.com/github/ansible/ansible", + "Code of Conduct": "https://docs.ansible.com/ansible/latest/community/code_of_conduct.html", + "Documentation": "https://docs.ansible.com/ansible/", + "Mailing lists": "https://docs.ansible.com/ansible/latest/community/communication.html#mailing-list-information", + "Source Code": "https://github.com/ansible/ansible", + }, + license="GPLv3+", + # Ansible will also make use of a system copy of python-six and + # python-selectors2 if installed but use a Bundled copy if it's not. + python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", + package_dir={"": "lib"}, + packages=find_packages("lib"), + package_data={ + "": [ + "module_utils/powershell/*.psm1", + "module_utils/powershell/*/*.psm1", + "modules/windows/*.ps1", + "modules/windows/*/*.ps1", + "galaxy/data/*/*.*", + "galaxy/data/*/*/.*", + "galaxy/data/*/*/*.*", + "galaxy/data/*/tests/inventory", + "config/base.yml", + "config/module_defaults.yml", + ] + }, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Natural Language :: English", + "Operating System :: POSIX", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Topic :: System :: Installation/Setup", + "Topic :: System :: Systems Administration", + "Topic :: Utilities", + ], + scripts=[ + "bin/ansible", + "bin/ansible-playbook", + "bin/ansible-pull", + "bin/ansible-doc", + "bin/ansible-galaxy", + "bin/ansible-console", + "bin/ansible-connection", + "bin/ansible-vault", + "bin/ansible-config", + "bin/ansible-inventory", + ], + data_files=[], + # Installing as zip files would break due to references to __file__ + zip_safe=False, +) + + +def main(): + """Invoke installation process using setuptools.""" + setup_params = dict(static_setup_params, **get_dynamic_setup_params()) + ignore_warning_regex = ( + r"Unknown distribution option: '(project_urls|python_requires)'" + ) + warnings.filterwarnings( + "ignore", + message=ignore_warning_regex, + category=UserWarning, + module="distutils.dist", + ) + setup(**setup_params) + warnings.resetwarnings() + + +if __name__ == "__main__": + main() diff --git a/tests/packagedcode/data/pypi/more_setup.py/ansible/setup.py-expected-args.json b/tests/packagedcode/data/pypi/more_setup.py/ansible/setup.py-expected-args.json new file mode 100644 index 00000000000..9e26dfeeb6e --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/ansible/setup.py-expected-args.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/pygtrie_setup.py-expected.json b/tests/packagedcode/data/pypi/more_setup.py/ansible/setup.py-expected.json similarity index 100% rename from tests/packagedcode/data/pypi/setup.py/pygtrie_setup.py-expected.json rename to tests/packagedcode/data/pypi/more_setup.py/ansible/setup.py-expected.json diff --git a/tests/packagedcode/data/pypi/more_setup.py/extras_require_with_vars_setup.py b/tests/packagedcode/data/pypi/more_setup.py/extras_require_with_vars_setup.py new file mode 100644 index 00000000000..5d7962dfebf --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/extras_require_with_vars_setup.py @@ -0,0 +1,11 @@ +from setuptools import setup + +tests_require = ["pytest"] + +setup( + name="extras_require_with_vars", + version="0.0.1", + description="test setup_reader.py", + install_requires=[], + extras_require={"test": tests_require}, +) diff --git a/tests/packagedcode/data/pypi/more_setup.py/extras_require_with_vars_setup.py-expected-args.json b/tests/packagedcode/data/pypi/more_setup.py/extras_require_with_vars_setup.py-expected-args.json new file mode 100644 index 00000000000..c6152b8b880 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/extras_require_with_vars_setup.py-expected-args.json @@ -0,0 +1,10 @@ +{ + "name": "extras_require_with_vars", + "version": "0.0.1", + "description": "test setup_reader.py", + "extras_require": { + "test": [ + "pytest" + ] + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/extras_require_with_vars_setup.py-expected.json b/tests/packagedcode/data/pypi/more_setup.py/extras_require_with_vars_setup.py-expected.json new file mode 100644 index 00000000000..cfcf579dc68 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/extras_require_with_vars_setup.py-expected.json @@ -0,0 +1,48 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "extras_require_with_vars", + "version": "0.0.1", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "test setup_reader.py", + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": {}, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:pypi/pytest", + "extracted_requirement": "pytest", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/extras_require_with_vars", + "repository_download_url": "https://pypi.org/packages/source/e/extras_require_with_vars/extras_require_with_vars-0.0.1.tar.gz", + "api_data_url": "https://pypi.org/pypi/extras_require_with_vars/0.0.1/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/extras-require-with-vars@0.0.1" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/flask_setup.py b/tests/packagedcode/data/pypi/more_setup.py/flask_setup.py new file mode 100644 index 00000000000..2117d7ccc0a --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/flask_setup.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import io +import re +from collections import OrderedDict + +from setuptools import setup + +with io.open("README.rst", "rt", encoding="utf8") as f: + readme = f.read() + +with io.open("flask/__init__.py", "rt", encoding="utf8") as f: + version = re.search(r"__version__ = \'(.*?)\'", f.read()).group(1) + +setup( + name="Flask", + version=version, + url="https://www.palletsprojects.com/p/flask/", + project_urls=OrderedDict( + ( + ("Documentation", "http://flask.pocoo.org/docs/"), + ("Code", "https://github.com/pallets/flask"), + ("Issue tracker", "https://github.com/pallets/flask/issues"), + ) + ), + license="BSD", + author="Armin Ronacher", + author_email="armin.ronacher@active-4.com", + maintainer="Pallets team", + maintainer_email="contact@palletsprojects.com", + description="A simple framework for building complex web applications.", + long_description=readme, + packages=["flask", "flask.json"], + include_package_data=True, + zip_safe=False, + platforms="any", + python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", + install_requires=[ + "Werkzeug>=0.14", + "Jinja2>=2.10", + "itsdangerous>=0.24", + "click>=5.1", + ], + extras_require={ + "dotenv": ["python-dotenv"], + "dev": [ + "pytest>=3", + "coverage", + "tox", + "sphinx", + "pallets-sphinx-themes", + "sphinxcontrib-log-cabinet", + ], + "docs": ["sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet"], + }, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Flask", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", + "Topic :: Software Development :: Libraries :: Application Frameworks", + "Topic :: Software Development :: Libraries :: Python Modules", + ], + entry_points={"console_scripts": ["flask = flask.cli:main"]}, +) diff --git a/tests/packagedcode/data/pypi/more_setup.py/flask_setup.py-expected-args.json b/tests/packagedcode/data/pypi/more_setup.py/flask_setup.py-expected-args.json new file mode 100644 index 00000000000..329c625f793 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/flask_setup.py-expected-args.json @@ -0,0 +1,55 @@ +{ + "name": "Flask", + "url": "https://www.palletsprojects.com/p/flask/", + "license": "BSD", + "author": "Armin Ronacher", + "author_email": "armin.ronacher@active-4.com", + "maintainer": "Pallets team", + "maintainer_email": "contact@palletsprojects.com", + "description": "A simple framework for building complex web applications.", + "platforms": "any", + "python_requires": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", + "install_requires": [ + "Werkzeug>=0.14", + "Jinja2>=2.10", + "itsdangerous>=0.24", + "click>=5.1" + ], + "extras_require": { + "dotenv": [ + "python-dotenv" + ], + "dev": [ + "pytest>=3", + "coverage", + "tox", + "sphinx", + "pallets-sphinx-themes", + "sphinxcontrib-log-cabinet" + ], + "docs": [ + "sphinx", + "pallets-sphinx-themes", + "sphinxcontrib-log-cabinet" + ] + }, + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Flask", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", + "Topic :: Software Development :: Libraries :: Application Frameworks", + "Topic :: Software Development :: Libraries :: Python Modules" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/flask_setup.py-expected.json b/tests/packagedcode/data/pypi/more_setup.py/flask_setup.py-expected.json new file mode 100644 index 00000000000..e7e5e913572 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/flask_setup.py-expected.json @@ -0,0 +1,204 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "Flask", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "A simple framework for building complex web applications.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "url": null + }, + { + "type": "person", + "role": "maintainer", + "name": "Pallets team", + "email": "contact@palletsprojects.com", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Flask", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", + "Topic :: Software Development :: Libraries :: Application Frameworks", + "Topic :: Software Development :: Libraries :: Python Modules" + ], + "homepage_url": "https://www.palletsprojects.com/p/flask/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "unknown AND bsd-new", + "declared_license": { + "license": "BSD", + "classifiers": [ + "License :: OSI Approved :: BSD License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" + }, + "dependencies": [ + { + "purl": "pkg:pypi/werkzeug", + "extracted_requirement": "Werkzeug>=0.14", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/jinja2", + "extracted_requirement": "Jinja2>=2.10", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/itsdangerous", + "extracted_requirement": "itsdangerous>=0.24", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/click", + "extracted_requirement": "click>=5.1", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/python-dotenv", + "extracted_requirement": "python-dotenv", + "scope": "dotenv", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pytest", + "extracted_requirement": "pytest>=3", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/coverage", + "extracted_requirement": "coverage", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/tox", + "extracted_requirement": "tox", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/sphinx", + "extracted_requirement": "sphinx", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pallets-sphinx-themes", + "extracted_requirement": "pallets-sphinx-themes", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/sphinxcontrib-log-cabinet", + "extracted_requirement": "sphinxcontrib-log-cabinet", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/sphinx", + "extracted_requirement": "sphinx", + "scope": "docs", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pallets-sphinx-themes", + "extracted_requirement": "pallets-sphinx-themes", + "scope": "docs", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/sphinxcontrib-log-cabinet", + "extracted_requirement": "sphinxcontrib-log-cabinet", + "scope": "docs", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/Flask", + "repository_download_url": null, + "api_data_url": "https://pypi.org/pypi/Flask/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/flask" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/pendulum_setup.py b/tests/packagedcode/data/pypi/more_setup.py/pendulum_setup.py new file mode 100644 index 00000000000..702e08f4ce1 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/pendulum_setup.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +from distutils.core import setup + +packages = [ + "pendulum", + "pendulum._extensions", + "pendulum.formatting", + "pendulum.locales", + "pendulum.locales.da", + "pendulum.locales.de", + "pendulum.locales.en", + "pendulum.locales.es", + "pendulum.locales.fa", + "pendulum.locales.fo", + "pendulum.locales.fr", + "pendulum.locales.ko", + "pendulum.locales.lt", + "pendulum.locales.pt_br", + "pendulum.locales.zh", + "pendulum.mixins", + "pendulum.parsing", + "pendulum.parsing.exceptions", + "pendulum.tz", + "pendulum.tz.data", + "pendulum.tz.zoneinfo", + "pendulum.utils", +] + +package_data = {"": ["*"]} + +install_requires = ["python-dateutil>=2.6,<3.0", "pytzdata>=2018.3"] + +extras_require = {':python_version < "3.5"': ["typing>=3.6,<4.0"]} + +setup_kwargs = { + "name": "pendulum", + "version": "2.0.4", + "description": "Python datetimes made easy", + "author": "Sébastien Eustace", + "author_email": "sebastien@eustace.io", + "url": "https://pendulum.eustace.io", + "packages": packages, + "package_data": package_data, + "install_requires": install_requires, + "extras_require": extras_require, + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", +} +from build import * + +build(setup_kwargs) + +setup(**setup_kwargs) diff --git a/tests/packagedcode/data/pypi/more_setup.py/pendulum_setup.py-expected-args.json b/tests/packagedcode/data/pypi/more_setup.py/pendulum_setup.py-expected-args.json new file mode 100644 index 00000000000..c4655d887b1 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/pendulum_setup.py-expected-args.json @@ -0,0 +1,18 @@ +{ + "name": "pendulum", + "version": "2.0.4", + "description": "Python datetimes made easy", + "author": "S\u00e9bastien Eustace", + "author_email": "sebastien@eustace.io", + "url": "https://pendulum.eustace.io", + "install_requires": [ + "python-dateutil>=2.6,<3.0", + "pytzdata>=2018.3" + ], + "extras_require": { + ":python_version < \"3.5\"": [ + "typing>=3.6,<4.0" + ] + }, + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/pendulum_setup.py-expected.json b/tests/packagedcode/data/pypi/more_setup.py/pendulum_setup.py-expected.json new file mode 100644 index 00000000000..b868dc79b68 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/pendulum_setup.py-expected.json @@ -0,0 +1,76 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "pendulum", + "version": "2.0.4", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Python datetimes made easy", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "S\u00e9bastien Eustace", + "email": "sebastien@eustace.io", + "url": null + } + ], + "keywords": [], + "homepage_url": "https://pendulum.eustace.io", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": {}, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + }, + "dependencies": [ + { + "purl": "pkg:pypi/python-dateutil", + "extracted_requirement": "python-dateutil<3.0,>=2.6", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pytzdata", + "extracted_requirement": "pytzdata>=2018.3", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/typing", + "extracted_requirement": "typing<4.0,>=3.6", + "scope": ":python_version < \"3.5\"", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/pendulum", + "repository_download_url": "https://pypi.org/packages/source/p/pendulum/pendulum-2.0.4.tar.gz", + "api_data_url": "https://pypi.org/pypi/pendulum/2.0.4/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/pendulum@2.0.4" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/pyyaml_setup.py b/tests/packagedcode/data/pypi/more_setup.py/pyyaml_setup.py new file mode 100644 index 00000000000..5285386ba55 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/pyyaml_setup.py @@ -0,0 +1,354 @@ +NAME = "PyYAML" +VERSION = "3.13" +DESCRIPTION = "YAML parser and emitter for Python" +LONG_DESCRIPTION = """\ +YAML is a data serialization format designed for human readability +and interaction with scripting languages. PyYAML is a YAML parser +and emitter for Python. + +PyYAML features a complete YAML 1.1 parser, Unicode support, pickle +support, capable extension API, and sensible error messages. PyYAML +supports standard YAML tags and provides Python-specific tags that +allow to represent an arbitrary Python object. + +PyYAML is applicable for a broad range of tasks from complex +configuration files to object serialization and persistance.""" +AUTHOR = "Kirill Simonov" +AUTHOR_EMAIL = "xi@resolvent.net" +LICENSE = "MIT" +PLATFORMS = "Any" +URL = "http://pyyaml.org/wiki/PyYAML" +DOWNLOAD_URL = "http://pyyaml.org/download/pyyaml/%s-%s.tar.gz" % (NAME, VERSION) +CLASSIFIERS = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Markup", +] + + +LIBYAML_CHECK = """ +#include <yaml.h> + +int main(void) { + yaml_parser_t parser; + yaml_emitter_t emitter; + + yaml_parser_initialize(&parser); + yaml_parser_delete(&parser); + + yaml_emitter_initialize(&emitter); + yaml_emitter_delete(&emitter); + + return 0; +} +""" + + +import sys, os.path, platform + +from distutils import log +from distutils.core import setup, Command +from distutils.core import Distribution as _Distribution +from distutils.core import Extension as _Extension +from distutils.dir_util import mkpath +from distutils.command.build_ext import build_ext as _build_ext +from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm +from distutils.errors import ( + DistutilsError, + CompileError, + LinkError, + DistutilsPlatformError, +) + +if "setuptools.extension" in sys.modules: + _Extension = sys.modules["setuptools.extension"]._Extension + sys.modules["distutils.core"].Extension = _Extension + sys.modules["distutils.extension"].Extension = _Extension + sys.modules["distutils.command.build_ext"].Extension = _Extension + +with_cython = False +try: + from Cython.Distutils.extension import Extension as _Extension + from Cython.Distutils import build_ext as _build_ext + + with_cython = True +except ImportError: + pass + +try: + from wheel.bdist_wheel import bdist_wheel +except ImportError: + bdist_wheel = None + + +class Distribution(_Distribution): + def __init__(self, attrs=None): + _Distribution.__init__(self, attrs) + if not self.ext_modules: + return + for idx in range(len(self.ext_modules) - 1, -1, -1): + ext = self.ext_modules[idx] + if not isinstance(ext, Extension): + continue + setattr(self, ext.attr_name, None) + self.global_options = [ + ( + ext.option_name, + None, + "include %s (default if %s is available)" + % (ext.feature_description, ext.feature_name), + ), + (ext.neg_option_name, None, "exclude %s" % ext.feature_description), + ] + self.global_options + self.negative_opt = self.negative_opt.copy() + self.negative_opt[ext.neg_option_name] = ext.option_name + + def has_ext_modules(self): + if not self.ext_modules: + return False + for ext in self.ext_modules: + with_ext = self.ext_status(ext) + if with_ext is None or with_ext: + return True + return False + + def ext_status(self, ext): + implementation = platform.python_implementation() + if implementation != "CPython": + return False + if isinstance(ext, Extension): + with_ext = getattr(self, ext.attr_name) + return with_ext + else: + return True + + +class Extension(_Extension): + def __init__( + self, name, sources, feature_name, feature_description, feature_check, **kwds + ): + if not with_cython: + for filename in sources[:]: + base, ext = os.path.splitext(filename) + if ext == ".pyx": + sources.remove(filename) + sources.append("%s.c" % base) + _Extension.__init__(self, name, sources, **kwds) + self.feature_name = feature_name + self.feature_description = feature_description + self.feature_check = feature_check + self.attr_name = "with_" + feature_name.replace("-", "_") + self.option_name = "with-" + feature_name + self.neg_option_name = "without-" + feature_name + + +class build_ext(_build_ext): + def run(self): + optional = True + disabled = True + for ext in self.extensions: + with_ext = self.distribution.ext_status(ext) + if with_ext is None: + disabled = False + elif with_ext: + optional = False + disabled = False + break + if disabled: + return + try: + _build_ext.run(self) + except DistutilsPlatformError: + exc = sys.exc_info()[1] + if optional: + log.warn(str(exc)) + log.warn("skipping build_ext") + else: + raise + + def get_source_files(self): + self.check_extensions_list(self.extensions) + filenames = [] + for ext in self.extensions: + if with_cython: + self.cython_sources(ext.sources, ext) + for filename in ext.sources: + filenames.append(filename) + base = os.path.splitext(filename)[0] + for ext in ["c", "h", "pyx", "pxd"]: + filename = "%s.%s" % (base, ext) + if filename not in filenames and os.path.isfile(filename): + filenames.append(filename) + return filenames + + def get_outputs(self): + self.check_extensions_list(self.extensions) + outputs = [] + for ext in self.extensions: + fullname = self.get_ext_fullname(ext.name) + filename = os.path.join(self.build_lib, self.get_ext_filename(fullname)) + if os.path.isfile(filename): + outputs.append(filename) + return outputs + + def build_extensions(self): + self.check_extensions_list(self.extensions) + for ext in self.extensions: + with_ext = self.distribution.ext_status(ext) + if with_ext is None: + with_ext = self.check_extension_availability(ext) + if not with_ext: + continue + if with_cython: + ext.sources = self.cython_sources(ext.sources, ext) + self.build_extension(ext) + + def check_extension_availability(self, ext): + cache = os.path.join(self.build_temp, "check_%s.out" % ext.feature_name) + if not self.force and os.path.isfile(cache): + data = open(cache).read().strip() + if data == "1": + return True + elif data == "0": + return False + mkpath(self.build_temp) + src = os.path.join(self.build_temp, "check_%s.c" % ext.feature_name) + open(src, "w").write(ext.feature_check) + log.info("checking if %s is compilable" % ext.feature_name) + try: + [obj] = self.compiler.compile( + [src], + macros=ext.define_macros + [(undef,) for undef in ext.undef_macros], + include_dirs=ext.include_dirs, + extra_postargs=(ext.extra_compile_args or []), + depends=ext.depends, + ) + except CompileError: + log.warn("") + log.warn( + "%s is not found or a compiler error: forcing --%s" + % (ext.feature_name, ext.neg_option_name) + ) + log.warn( + "(if %s is installed correctly, you may need to" % ext.feature_name + ) + log.warn(" specify the option --include-dirs or uncomment and") + log.warn(" modify the parameter include_dirs in setup.cfg)") + open(cache, "w").write("0\n") + return False + prog = "check_%s" % ext.feature_name + log.info("checking if %s is linkable" % ext.feature_name) + try: + self.compiler.link_executable( + [obj], + prog, + output_dir=self.build_temp, + libraries=ext.libraries, + library_dirs=ext.library_dirs, + runtime_library_dirs=ext.runtime_library_dirs, + extra_postargs=(ext.extra_link_args or []), + ) + except LinkError: + log.warn("") + log.warn( + "%s is not found or a linker error: forcing --%s" + % (ext.feature_name, ext.neg_option_name) + ) + log.warn( + "(if %s is installed correctly, you may need to" % ext.feature_name + ) + log.warn(" specify the option --library-dirs or uncomment and") + log.warn(" modify the parameter library_dirs in setup.cfg)") + open(cache, "w").write("0\n") + return False + open(cache, "w").write("1\n") + return True + + +class bdist_rpm(_bdist_rpm): + def _make_spec_file(self): + argv0 = sys.argv[0] + features = [] + for ext in self.distribution.ext_modules: + if not isinstance(ext, Extension): + continue + with_ext = getattr(self.distribution, ext.attr_name) + if with_ext is None: + continue + if with_ext: + features.append("--" + ext.option_name) + else: + features.append("--" + ext.neg_option_name) + sys.argv[0] = " ".join([argv0] + features) + spec_file = _bdist_rpm._make_spec_file(self) + sys.argv[0] = argv0 + return spec_file + + +class test(Command): + + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + build_cmd = self.get_finalized_command("build") + build_cmd.run() + sys.path.insert(0, build_cmd.build_lib) + if sys.version_info[0] < 3: + sys.path.insert(0, "tests/lib") + else: + sys.path.insert(0, "tests/lib3") + import test_all + + if not test_all.main([]): + raise DistutilsError("Tests failed") + + +cmdclass = {"build_ext": build_ext, "bdist_rpm": bdist_rpm, "test": test} +if bdist_wheel: + cmdclass["bdist_wheel"] = bdist_wheel + + +if __name__ == "__main__": + + setup( + name=NAME, + version=VERSION, + description=DESCRIPTION, + long_description=LONG_DESCRIPTION, + author=AUTHOR, + author_email=AUTHOR_EMAIL, + license=LICENSE, + platforms=PLATFORMS, + url=URL, + download_url=DOWNLOAD_URL, + classifiers=CLASSIFIERS, + package_dir={"": {2: "lib", 3: "lib3"}[sys.version_info[0]]}, + packages=["yaml"], + ext_modules=[ + Extension( + "_yaml", + ["ext/_yaml.pyx"], + "libyaml", + "LibYAML bindings", + LIBYAML_CHECK, + libraries=["yaml"], + ) + ], + distclass=Distribution, + cmdclass=cmdclass, + ) diff --git a/tests/packagedcode/data/pypi/more_setup.py/pyyaml_setup.py-expected-args.json b/tests/packagedcode/data/pypi/more_setup.py/pyyaml_setup.py-expected-args.json new file mode 100644 index 00000000000..d867ef438ae --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/pyyaml_setup.py-expected-args.json @@ -0,0 +1,28 @@ +{ + "name": "PyYAML", + "version": "3.13", + "description": "YAML parser and emitter for Python", + "long_description": "YAML is a data serialization format designed for human readability\nand interaction with scripting languages. PyYAML is a YAML parser\nand emitter for Python.\n\nPyYAML features a complete YAML 1.1 parser, Unicode support, pickle\nsupport, capable extension API, and sensible error messages. PyYAML\nsupports standard YAML tags and provides Python-specific tags that\nallow to represent an arbitrary Python object.\n\nPyYAML is applicable for a broad range of tasks from complex\nconfiguration files to object serialization and persistance.", + "author": "Kirill Simonov", + "author_email": "xi@resolvent.net", + "license": "MIT", + "platforms": "Any", + "url": "http://pyyaml.org/wiki/PyYAML", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Markup" + ], + "package_dir": { + "": null + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/pyyaml_setup.py-expected.json b/tests/packagedcode/data/pypi/more_setup.py/pyyaml_setup.py-expected.json new file mode 100644 index 00000000000..e020ad946e5 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/pyyaml_setup.py-expected.json @@ -0,0 +1,63 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "PyYAML", + "version": "3.13", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "YAML parser and emitter for Python", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Kirill Simonov", + "email": "xi@resolvent.net", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Markup" + ], + "homepage_url": "http://pyyaml.org/wiki/PyYAML", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/PyYAML", + "repository_download_url": "https://pypi.org/packages/source/P/PyYAML/PyYAML-3.13.tar.gz", + "api_data_url": "https://pypi.org/pypi/PyYAML/3.13/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/pyyaml@3.13" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/requests_setup.py b/tests/packagedcode/data/pypi/more_setup.py/requests_setup.py new file mode 100644 index 00000000000..0591adb81cb --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/requests_setup.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# Learn more: https://github.com/kennethreitz/setup.py +import os +import re +import sys + +from codecs import open + +from setuptools import setup +from setuptools.command.test import test as TestCommand + +here = os.path.abspath(os.path.dirname(__file__)) + + +class PyTest(TestCommand): + user_options = [("pytest-args=", "a", "Arguments to pass into py.test")] + + def initialize_options(self): + TestCommand.initialize_options(self) + try: + from multiprocessing import cpu_count + + self.pytest_args = ["-n", str(cpu_count()), "--boxed"] + except (ImportError, NotImplementedError): + self.pytest_args = ["-n", "1", "--boxed"] + + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + self.test_suite = True + + def run_tests(self): + import pytest + + errno = pytest.main(self.pytest_args) + sys.exit(errno) + + +# 'setup.py publish' shortcut. +if sys.argv[-1] == "publish": + os.system("python setup.py sdist bdist_wheel") + os.system("twine upload dist/*") + sys.exit() + +packages = ["requests"] + +requires = [ + "chardet>=3.0.2,<3.1.0", + "idna>=2.5,<2.8", + "urllib3>=1.21.1,<1.25", + "certifi>=2017.4.17", +] +test_requirements = [ + "pytest-httpbin==0.0.7", + "pytest-cov", + "pytest-mock", + "pytest-xdist", + "PySocks>=1.5.6, !=1.5.7", + "pytest>=2.8.0", +] + +about = {} +with open(os.path.join(here, "requests", "__version__.py"), "r", "utf-8") as f: + exec(f.read(), about) + +with open("README.md", "r", "utf-8") as f: + readme = f.read() +with open("HISTORY.md", "r", "utf-8") as f: + history = f.read() + +setup( + name=about["__title__"], + version=about["__version__"], + description=about["__description__"], + long_description=readme, + long_description_content_type="text/markdown", + author=about["__author__"], + author_email=about["__author_email__"], + url=about["__url__"], + packages=packages, + package_data={"": ["LICENSE", "NOTICE"], "requests": ["*.pem"]}, + package_dir={"requests": "requests"}, + include_package_data=True, + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", + install_requires=requires, + license=about["__license__"], + zip_safe=False, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + ], + cmdclass={"test": PyTest}, + tests_require=test_requirements, + extras_require={ + "security": ["pyOpenSSL >= 0.14", "cryptography>=1.3.4", "idna>=2.0.0"], + "socks": ["PySocks>=1.5.6, !=1.5.7"], + 'socks:sys_platform == "win32" and python_version == "2.7"': ["win_inet_pton"], + }, +) diff --git a/tests/packagedcode/data/pypi/more_setup.py/requests_setup.py-expected-args.json b/tests/packagedcode/data/pypi/more_setup.py/requests_setup.py-expected-args.json new file mode 100644 index 00000000000..0fde1c84e73 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/requests_setup.py-expected-args.json @@ -0,0 +1,50 @@ +{ + "long_description_content_type": "text/markdown", + "package_dir": { + "requests": "requests" + }, + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", + "install_requires": [ + "chardet>=3.0.2,<3.1.0", + "idna>=2.5,<2.8", + "urllib3>=1.21.1,<1.25", + "certifi>=2017.4.17" + ], + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy" + ], + "tests_require": [ + "pytest-httpbin==0.0.7", + "pytest-cov", + "pytest-mock", + "pytest-xdist", + "PySocks>=1.5.6, !=1.5.7", + "pytest>=2.8.0" + ], + "extras_require": { + "security": [ + "pyOpenSSL >= 0.14", + "cryptography>=1.3.4", + "idna>=2.0.0" + ], + "socks": [ + "PySocks>=1.5.6, !=1.5.7" + ], + "socks:sys_platform == \"win32\" and python_version == \"2.7\"": [ + "win_inet_pton" + ] + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/requests_setup.py-expected.json b/tests/packagedcode/data/pypi/more_setup.py/requests_setup.py-expected.json new file mode 100644 index 00000000000..5947a2cef3c --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/requests_setup.py-expected.json @@ -0,0 +1,140 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "", + "release_date": null, + "parties": [], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy" + ], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "apache-2.0", + "declared_license": { + "classifiers": [ + "License :: OSI Approved :: Apache Software License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + }, + "dependencies": [ + { + "purl": "pkg:pypi/chardet", + "extracted_requirement": "chardet<3.1.0,>=3.0.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/idna", + "extracted_requirement": "idna<2.8,>=2.5", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/urllib3", + "extracted_requirement": "urllib3<1.25,>=1.21.1", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/certifi", + "extracted_requirement": "certifi>=2017.4.17", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pyopenssl", + "extracted_requirement": "pyOpenSSL>=0.14", + "scope": "security", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/cryptography", + "extracted_requirement": "cryptography>=1.3.4", + "scope": "security", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/idna", + "extracted_requirement": "idna>=2.0.0", + "scope": "security", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pysocks", + "extracted_requirement": "PySocks!=1.5.7,>=1.5.6", + "scope": "socks", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/win-inet-pton", + "extracted_requirement": "win_inet_pton", + "scope": "socks:sys_platform == \"win32\" and python_version == \"2.7\"", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "pypi_setup_py", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/sqlalchemy_setup.py b/tests/packagedcode/data/pypi/more_setup.py/sqlalchemy_setup.py new file mode 100644 index 00000000000..8842a482d27 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/sqlalchemy_setup.py @@ -0,0 +1,202 @@ +import os +import platform +import re +import sys +from distutils.command.build_ext import build_ext +from distutils.errors import CCompilerError +from distutils.errors import DistutilsExecError +from distutils.errors import DistutilsPlatformError +from setuptools import Distribution as _Distribution, Extension +from setuptools import setup +from setuptools import find_packages +from setuptools.command.test import test as TestCommand + +cmdclass = {} +if sys.version_info < (2, 7): + raise Exception("SQLAlchemy requires Python 2.7 or higher.") + +cpython = platform.python_implementation() == "CPython" + +ext_modules = [ + Extension( + "sqlalchemy.cprocessors", sources=["lib/sqlalchemy/cextension/processors.c"] + ), + Extension( + "sqlalchemy.cresultproxy", sources=["lib/sqlalchemy/cextension/resultproxy.c"] + ), + Extension("sqlalchemy.cutils", sources=["lib/sqlalchemy/cextension/utils.c"]), +] + +ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) +if sys.platform == "win32": + # 2.6's distutils.msvc9compiler can raise an IOError when failing to + # find the compiler + ext_errors += (IOError,) + + +class BuildFailed(Exception): + def __init__(self): + self.cause = sys.exc_info()[1] # work around py 2/3 different syntax + + +class ve_build_ext(build_ext): + # This class allows C extension building to fail. + + def run(self): + try: + build_ext.run(self) + except DistutilsPlatformError: + raise BuildFailed() + + def build_extension(self, ext): + try: + build_ext.build_extension(self, ext) + except ext_errors: + raise BuildFailed() + except ValueError: + # this can happen on Windows 64 bit, see Python issue 7511 + if "'path'" in str(sys.exc_info()[1]): # works with both py 2/3 + raise BuildFailed() + raise + + +cmdclass["build_ext"] = ve_build_ext + + +class Distribution(_Distribution): + def has_ext_modules(self): + # We want to always claim that we have ext_modules. This will be fine + # if we don't actually have them (such as on PyPy) because nothing + # will get built, however we don't want to provide an overally broad + # Wheel package when building a wheel without C support. This will + # ensure that Wheel knows to treat us as if the build output is + # platform specific. + return True + + +class PyTest(TestCommand): + # from http://pytest.org/latest/goodpractices.html\ + # #integrating-with-setuptools-python-setup-py-test-pytest-runner + # TODO: prefer pytest-runner package at some point, however it was + # not working at the time of this comment. + user_options = [("pytest-args=", "a", "Arguments to pass to py.test")] + + default_options = ["-n", "4", "-q", "--nomemory"] + + def initialize_options(self): + TestCommand.initialize_options(self) + self.pytest_args = "" + + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + self.test_suite = True + + def run_tests(self): + import shlex + + # import here, cause outside the eggs aren't loaded + import pytest + + errno = pytest.main(self.default_options + shlex.split(self.pytest_args)) + sys.exit(errno) + + +cmdclass["test"] = PyTest + + +def status_msgs(*msgs): + print("*" * 75) + for msg in msgs: + print(msg) + print("*" * 75) + + +with open( + os.path.join(os.path.dirname(__file__), "lib", "sqlalchemy", "__init__.py") +) as v_file: + VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v_file.read()).group(1) + +with open(os.path.join(os.path.dirname(__file__), "README.rst")) as r_file: + readme = r_file.read() + + +def run_setup(with_cext): + kwargs = {} + if with_cext: + kwargs["ext_modules"] = ext_modules + else: + kwargs["ext_modules"] = [] + + setup( + name="SQLAlchemy", + version=VERSION, + description="Database Abstraction Library", + author="Mike Bayer", + author_email="mike_mp@zzzcomputing.com", + url="http://www.sqlalchemy.org", + packages=find_packages("lib"), + package_dir={"": "lib"}, + license="MIT License", + cmdclass=cmdclass, + tests_require=["pytest >= 2.5.2", "mock", "pytest-xdist"], + long_description=readme, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Database :: Front-Ends", + "Operating System :: OS Independent", + ], + distclass=Distribution, + extras_require={ + "mysql": ["mysqlclient"], + "pymysql": ["pymysql"], + "postgresql": ["psycopg2"], + "postgresql_pg8000": ["pg8000"], + "postgresql_psycopg2cffi": ["psycopg2cffi"], + "oracle": ["cx_oracle"], + "mssql_pyodbc": ["pyodbc"], + "mssql_pymssql": ["pymssql"], + }, + **kwargs + ) + + +if not cpython: + run_setup(False) + status_msgs( + "WARNING: C extensions are not supported on " + + "this Python platform, speedups are not enabled.", + "Plain-Python build succeeded.", + ) +elif os.environ.get("DISABLE_SQLALCHEMY_CEXT"): + run_setup(False) + status_msgs( + "DISABLE_SQLALCHEMY_CEXT is set; " + "not attempting to build C extensions.", + "Plain-Python build succeeded.", + ) + +else: + try: + run_setup(True) + except BuildFailed as exc: + status_msgs( + exc.cause, + "WARNING: The C extension could not be compiled, " + + "speedups are not enabled.", + "Failure information, if any, is above.", + "Retrying the build without the C extension now.", + ) + + run_setup(False) + + status_msgs( + "WARNING: The C extension could not be compiled, " + + "speedups are not enabled.", + "Plain-Python build succeeded.", + ) diff --git a/tests/packagedcode/data/pypi/more_setup.py/sqlalchemy_setup.py-expected-args.json b/tests/packagedcode/data/pypi/more_setup.py/sqlalchemy_setup.py-expected-args.json new file mode 100644 index 00000000000..7ca26807c2f --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/sqlalchemy_setup.py-expected-args.json @@ -0,0 +1,53 @@ +{ + "name": "SQLAlchemy", + "description": "Database Abstraction Library", + "author": "Mike Bayer", + "author_email": "mike_mp@zzzcomputing.com", + "url": "http://www.sqlalchemy.org", + "package_dir": { + "": "lib" + }, + "license": "MIT License", + "tests_require": [ + "pytest >= 2.5.2", + "mock", + "pytest-xdist" + ], + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Database :: Front-Ends", + "Operating System :: OS Independent" + ], + "extras_require": { + "mysql": [ + "mysqlclient" + ], + "pymysql": [ + "pymysql" + ], + "postgresql": [ + "psycopg2" + ], + "postgresql_pg8000": [ + "pg8000" + ], + "postgresql_psycopg2cffi": [ + "psycopg2cffi" + ], + "oracle": [ + "cx_oracle" + ], + "mssql_pyodbc": [ + "pyodbc" + ], + "mssql_pymssql": [ + "pymssql" + ] + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/sqlalchemy_setup.py-expected.json b/tests/packagedcode/data/pypi/more_setup.py/sqlalchemy_setup.py-expected.json new file mode 100644 index 00000000000..cf712fcf620 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/sqlalchemy_setup.py-expected.json @@ -0,0 +1,133 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "SQLAlchemy", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Database Abstraction Library", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Mike Bayer", + "email": "mike_mp@zzzcomputing.com", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Database :: Front-Ends", + "Operating System :: OS Independent" + ], + "homepage_url": "http://www.sqlalchemy.org", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT License", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:pypi/mysqlclient", + "extracted_requirement": "mysqlclient", + "scope": "mysql", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pymysql", + "extracted_requirement": "pymysql", + "scope": "pymysql", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/psycopg2", + "extracted_requirement": "psycopg2", + "scope": "postgresql", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pg8000", + "extracted_requirement": "pg8000", + "scope": "postgresql_pg8000", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/psycopg2cffi", + "extracted_requirement": "psycopg2cffi", + "scope": "postgresql_psycopg2cffi", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/cx-oracle", + "extracted_requirement": "cx_oracle", + "scope": "oracle", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pyodbc", + "extracted_requirement": "pyodbc", + "scope": "mssql_pyodbc", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pymssql", + "extracted_requirement": "pymssql", + "scope": "mssql_pymssql", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/SQLAlchemy", + "repository_download_url": null, + "api_data_url": "https://pypi.org/pypi/SQLAlchemy/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/sqlalchemy" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/unpack_kwargs_setup.py b/tests/packagedcode/data/pypi/more_setup.py/unpack_kwargs_setup.py new file mode 100644 index 00000000000..03c5a539697 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/unpack_kwargs_setup.py @@ -0,0 +1,17 @@ +from setuptools import setup + + +kwargs = dict( + name="my-package", + license="MIT", + version="0.1.2", + description="Demo project.", + author="Sébastien Eustace", + author_email="sebastien@eustace.io", + url="https://github.com/demo/demo", + packages=["my_package"], + install_requires=["pendulum>=1.4.4", "cachy[msgpack]>=0.2.0"], +) + + +setup(**kwargs) diff --git a/tests/packagedcode/data/pypi/more_setup.py/unpack_kwargs_setup.py-expected-args.json b/tests/packagedcode/data/pypi/more_setup.py/unpack_kwargs_setup.py-expected-args.json new file mode 100644 index 00000000000..bb9f7ff61f2 --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/unpack_kwargs_setup.py-expected-args.json @@ -0,0 +1,13 @@ +{ + "name": "my-package", + "license": "MIT", + "version": "0.1.2", + "description": "Demo project.", + "author": "S\u00e9bastien Eustace", + "author_email": "sebastien@eustace.io", + "url": "https://github.com/demo/demo", + "install_requires": [ + "pendulum>=1.4.4", + "cachy[msgpack]>=0.2.0" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/unpack_kwargs_setup.py-expected.json b/tests/packagedcode/data/pypi/more_setup.py/unpack_kwargs_setup.py-expected.json new file mode 100644 index 00000000000..f29740e7b1e --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/unpack_kwargs_setup.py-expected.json @@ -0,0 +1,67 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "my-package", + "version": "0.1.2", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Demo project.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "S\u00e9bastien Eustace", + "email": "sebastien@eustace.io", + "url": null + } + ], + "keywords": [], + "homepage_url": "https://github.com/demo/demo", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT" + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:pypi/pendulum", + "extracted_requirement": "pendulum>=1.4.4", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/cachy", + "extracted_requirement": "cachy[msgpack]>=0.2.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/my-package", + "repository_download_url": "https://pypi.org/packages/source/m/my-package/my-package-0.1.2.tar.gz", + "api_data_url": "https://pypi.org/pypi/my-package/0.1.2/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/my-package@0.1.2" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/more_setup.py/with_extras_setup.cfg b/tests/packagedcode/data/pypi/more_setup.py/with_extras_setup.cfg new file mode 100644 index 00000000000..6e50c78c23b --- /dev/null +++ b/tests/packagedcode/data/pypi/more_setup.py/with_extras_setup.cfg @@ -0,0 +1,24 @@ +[metadata] +name = with-setup-cfg +version = 1.2.3 +classifiers = + Framework :: Django + License :: OSI Approved :: BSD License + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + +[options] +zip_safe = true +python_requires = >=2.6,!=3.0,!=3.1,!=3.2,!=3.3 +setup_requires = setuptools>=36.2.2 +install_requires = + six + tomlkit + +[options.extras_require] +validation = + cerberus +tests = + pytest + pytest-xdist + pytest-cov diff --git a/tests/packagedcode/data/pypi/requirements_txt/complex/output.expected.json b/tests/packagedcode/data/pypi/requirements_txt/complex/output.expected.json index fe2ab3f4911..280433bccb1 100644 --- a/tests/packagedcode/data/pypi/requirements_txt/complex/output.expected.json +++ b/tests/packagedcode/data/pypi/requirements_txt/complex/output.expected.json @@ -27,7 +27,11 @@ "notice_text": null, "source_packages": [], "file_references": [], - "extra_data": {}, + "extra_data": { + "extra_index_urls": [ + "http://dist.pinaxproject.com/dev/" + ] + }, "dependencies": [ { "purl": "pkg:pypi/babel@0.9.6", diff --git a/tests/packagedcode/data/pypi/requirements_txt/simple/output.expected.json b/tests/packagedcode/data/pypi/requirements_txt/simple/output.expected.json index 55026094915..113cb9e7495 100644 --- a/tests/packagedcode/data/pypi/requirements_txt/simple/output.expected.json +++ b/tests/packagedcode/data/pypi/requirements_txt/simple/output.expected.json @@ -1,20 +1,23 @@ [ - { - "purl": "pkg:pypi/lxml@3.4.4", - "extracted_requirement": "==3.4.4", - "scope": "install", - "is_runtime": true, - "is_optional": false, - "is_resolved": true, - "resolved_package": {} - }, - { - "purl": "pkg:pypi/requests@2.7.0", - "extracted_requirement": "==2.7.0", - "scope": "install", - "is_runtime": true, - "is_optional": false, - "is_resolved": true, - "resolved_package": {} - } + [ + { + "purl": "pkg:pypi/lxml@3.4.4", + "extracted_requirement": "==3.4.4", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/requests@2.7.0", + "extracted_requirement": "==2.7.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + } + ], + {} ] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.cfg b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.cfg new file mode 100644 index 00000000000..872575a2eca --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.cfg @@ -0,0 +1,72 @@ +[metadata] +name = wheel +version = attr: wheel.__version__ +description = A built-package format for Python +long_description = file: README.rst +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Topic :: System :: Archiving :: Packaging + License :: OSI Approved :: MIT License + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 +author = Daniel Holth +author_email = dholth@fastmail.fm +maintainer = Alex Gronholm +maintainer_email = alex.gronholm@nextday.fi +url = https://github.com/pypa/wheel +project_urls = + Documentation = https://wheel.readthedocs.io/ + Changelog = https://wheel.readthedocs.io/en/stable/news.html + Issue Tracker = https://github.com/pypa/wheel/issues +keywords = wheel, packaging +license = MIT + +[options] +package_dir = + = src +packages = find: +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* +setup_requires = setuptools >= 40.9.0 +zip_safe = False + +[options.packages.find] +where = src + +[options.extras_require] +test = + pytest >= 3.0.0 + pytest-cov + +[options.entry_points] +console_scripts = + wheel = wheel.cli:main +distutils.commands = + bdist_wheel = wheel.bdist_wheel:bdist_wheel + +[tool:pytest] +addopts = --cov=wheel +testpaths = tests + +[coverage:run] +source = wheel + +[coverage:report] +show_missing = true + +[flake8] +max-line-length = 99 + +[bdist_wheel] +universal = 1 + +[egg_info] +tag_build = +tag_date = 0 + diff --git a/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.cfg-expected-args.json b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.cfg-expected-args.json new file mode 100644 index 00000000000..c52b020e8f8 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.cfg-expected-args.json @@ -0,0 +1,3 @@ +{ + "maintainer": "Alex Gr\u00f6nholm" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.cfg-expected.json b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.cfg-expected.json new file mode 100644 index 00000000000..aaf05585743 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.cfg-expected.json @@ -0,0 +1,46 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": null, + "version": "0.34.2", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "maintainer", + "name": "Alex Gr\u00f6nholm", + "email": null, + "url": null + } + ], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": {}, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "pypi_setup_py", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.py b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.py new file mode 100644 index 00000000000..628efe3b3d2 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/setup.py @@ -0,0 +1,4 @@ +# coding: utf-8 +from setuptools import setup + +setup(maintainer=u'Alex Grönholm') diff --git a/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/src/wheel/__init__.py b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/src/wheel/__init__.py new file mode 100644 index 00000000000..3c92ca223a4 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/src/wheel/__init__.py @@ -0,0 +1 @@ +__version__ = '0.34.2' diff --git a/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/src/wheel/__main__.py b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/src/wheel/__main__.py new file mode 100644 index 00000000000..b3773a20e08 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/src/wheel/__main__.py @@ -0,0 +1,19 @@ +""" +Wheel command line tool (enable python -m wheel syntax) +""" + +import sys + + +def main(): # needed for console script + if __package__ == '': + # To be able to run 'python wheel-0.9.whl/wheel': + import os.path + path = os.path.dirname(os.path.dirname(__file__)) + sys.path[0:0] = [path] + import wheel.cli + sys.exit(wheel.cli.main()) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/src/wheel/_version.py b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/src/wheel/_version.py new file mode 100644 index 00000000000..5f581f72ae1 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.cfg/wheel-0.34.2/src/wheel/_version.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# file generated by setuptools_scm +# don't change, don't track in version control +version = '0.33.6.post32+gd3d7a43' diff --git a/tests/packagedcode/data/pypi/setup.py/with_name-setup.py b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/with_name-setup.py similarity index 100% rename from tests/packagedcode/data/pypi/setup.py/with_name-setup.py rename to tests/packagedcode/data/pypi/setup.py-name-or-no-name/with_name-setup.py diff --git a/tests/packagedcode/data/pypi/setup.py/with_name-setup.py.args.expected.json b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/with_name-setup.py.args.expected.json similarity index 88% rename from tests/packagedcode/data/pypi/setup.py/with_name-setup.py.args.expected.json rename to tests/packagedcode/data/pypi/setup.py-name-or-no-name/with_name-setup.py.args.expected.json index 882e0019782..c68aa696189 100644 --- a/tests/packagedcode/data/pypi/setup.py/with_name-setup.py.args.expected.json +++ b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/with_name-setup.py.args.expected.json @@ -5,8 +5,5 @@ "author": "Stanis\u0142aw Pitucha", "author_email": "viraptor@gmail.com", "url": "http://bitbucket.org/viraptor/arpy", - "py_modules": [ - "arpy" - ], "license": "Simplified BSD" } \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/with_name-setup.py.expected.json b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/with_name-setup.py.expected.json similarity index 96% rename from tests/packagedcode/data/pypi/setup.py/with_name-setup.py.expected.json rename to tests/packagedcode/data/pypi/setup.py-name-or-no-name/with_name-setup.py.expected.json index 249b30df150..6280c9c8a7a 100644 --- a/tests/packagedcode/data/pypi/setup.py/with_name-setup.py.expected.json +++ b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/with_name-setup.py.expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Stanis\u0142aw Pitucha", - "email": null, + "email": "viraptor@gmail.com", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/without_name-setup.py b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/without_name-setup.py similarity index 100% rename from tests/packagedcode/data/pypi/setup.py/without_name-setup.py rename to tests/packagedcode/data/pypi/setup.py-name-or-no-name/without_name-setup.py diff --git a/tests/packagedcode/data/pypi/setup.py/without_name-setup.py.args.expected.json b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/without_name-setup.py.args.expected.json similarity index 57% rename from tests/packagedcode/data/pypi/setup.py/without_name-setup.py.args.expected.json rename to tests/packagedcode/data/pypi/setup.py-name-or-no-name/without_name-setup.py.args.expected.json index 95ecfb4cb83..d616686852b 100644 --- a/tests/packagedcode/data/pypi/setup.py/without_name-setup.py.args.expected.json +++ b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/without_name-setup.py.args.expected.json @@ -2,6 +2,5 @@ "version": "1.0.0", "description": "A sample package", "author": "Test", - "author_email": "test@gmail.com", - "package_requires": [] + "author_email": "test@gmail.com" } \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/without_name-setup.py.expected.json b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/without_name-setup.py.expected.json similarity index 96% rename from tests/packagedcode/data/pypi/setup.py/without_name-setup.py.expected.json rename to tests/packagedcode/data/pypi/setup.py-name-or-no-name/without_name-setup.py.expected.json index daec2aa7e64..35f7c6f9e0d 100644 --- a/tests/packagedcode/data/pypi/setup.py/without_name-setup.py.expected.json +++ b/tests/packagedcode/data/pypi/setup.py-name-or-no-name/without_name-setup.py.expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Test", - "email": null, + "email": "test@gmail.com", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/arpy_setup.py b/tests/packagedcode/data/pypi/setup.py-not-win/arpy_setup.py similarity index 100% rename from tests/packagedcode/data/pypi/setup.py/arpy_setup.py rename to tests/packagedcode/data/pypi/setup.py-not-win/arpy_setup.py diff --git a/tests/packagedcode/data/pypi/setup.py/arpy_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-not-win/arpy_setup.py-expected.json similarity index 96% rename from tests/packagedcode/data/pypi/setup.py/arpy_setup.py-expected.json rename to tests/packagedcode/data/pypi/setup.py-not-win/arpy_setup.py-expected.json index 249b30df150..6280c9c8a7a 100644 --- a/tests/packagedcode/data/pypi/setup.py/arpy_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-not-win/arpy_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Stanis\u0142aw Pitucha", - "email": null, + "email": "viraptor@gmail.com", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py-versions/asyncio-master/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/asyncio-master/setup.py-expected-args.json new file mode 100644 index 00000000000..1b9cc8b729a --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/asyncio-master/setup.py-expected-args.json @@ -0,0 +1,11 @@ +{ + "name": "asyncio", + "version": "3.4.4", + "description": "reference implementation of PEP 3156", + "url": "http://www.python.org/dev/peps/pep-3156/", + "classifiers": [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/asyncio-master/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/asyncio-master/setup.py-expected.json index 368c2eed701..680ff67bd5d 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/asyncio-master/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/asyncio-master/setup.py-expected.json @@ -1,40 +1,42 @@ -{ - "type": "pypi", - "namespace": null, - "name": "asyncio", - "version": "3.4.4", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "reference implementation of PEP 3156", - "release_date": null, - "parties": [], - "keywords": [ - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.3" - ], - "homepage_url": "http://www.python.org/dev/peps/pep-3156/", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": null, - "classifiers": [] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/asyncio@3.4.4", - "repository_homepage_url": "https://pypi.org/project/asyncio", - "repository_download_url": "https://pypi.io/packages/source/a/asyncio/asyncio-3.4.4.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/asyncio/3.4.4/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "asyncio", + "version": "3.4.4", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "reference implementation of PEP 3156", + "release_date": null, + "parties": [], + "keywords": [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3" + ], + "homepage_url": "http://www.python.org/dev/peps/pep-3156/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": {}, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/asyncio", + "repository_download_url": "https://pypi.org/packages/source/a/asyncio/asyncio-3.4.4.tar.gz", + "api_data_url": "https://pypi.org/pypi/asyncio/3.4.4/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/asyncio@3.4.4" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/cdp-seattle-backend-1.0.0/setup.py b/tests/packagedcode/data/pypi/setup.py-versions/cdp-seattle-backend-1.0.0/setup.py new file mode 100644 index 00000000000..1108904b9bc --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/cdp-seattle-backend-1.0.0/setup.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +"""The setup script.""" + +from setuptools import find_packages, setup + +test_requirements = [ + "black>=19.10b0", + "flake8>=3.8.3", + "flake8-debugger>=3.2.1", +] + +dev_requirements = [ + *test_requirements, + "wheel>=0.34.2", +] + +requirements = [ + "cdp-backend[pipeline]==3.0.16", + "cdp-scrapers>=0.4.0", +] + +extra_requirements = { + "test": test_requirements, + "dev": dev_requirements, + "all": [ + *requirements, + *dev_requirements, + ], +} + +setup( + author="Council Data Project Contributors", + classifiers=[ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3.9", + ], + description="Package containing the gather functions for Example.", + install_requires=requirements, + license="MIT license", + long_description_content_type="text/markdown", + include_package_data=True, + keywords="civic technology, open government", + name="cdp-seattle-backend", + packages=find_packages(exclude=["tests", "*.tests", "*.tests.*"]), + python_requires=">=3.9", + tests_require=test_requirements, + extras_require=extra_requirements, + url="https://github.com/CouncilDataProject/seattle", + version="1.0.0", + zip_safe=False, +) diff --git a/tests/packagedcode/data/pypi/setup.py-versions/cdp-seattle-backend-1.0.0/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/cdp-seattle-backend-1.0.0/setup.py-expected-args.json new file mode 100644 index 00000000000..5f2b56f0a32 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/cdp-seattle-backend-1.0.0/setup.py-expected-args.json @@ -0,0 +1,45 @@ +{ + "author": "Council Data Project Contributors", + "classifiers": [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3.9" + ], + "description": "Package containing the gather functions for Example.", + "install_requires": [ + "cdp-backend[pipeline]==3.0.16", + "cdp-scrapers>=0.4.0" + ], + "license": "MIT license", + "long_description_content_type": "text/markdown", + "keywords": [ + "civic technology", + "open government" + ], + "name": "cdp-seattle-backend", + "python_requires": ">=3.9", + "tests_require": [ + "black>=19.10b0", + "flake8>=3.8.3", + "flake8-debugger>=3.2.1" + ], + "extras_require": { + "test": [ + "black>=19.10b0", + "flake8>=3.8.3", + "flake8-debugger>=3.2.1" + ], + "dev": [ + null, + "wheel>=0.34.2" + ], + "all": [ + null, + null + ] + }, + "url": "https://github.com/CouncilDataProject/seattle", + "version": "1.0.0" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/cdp-seattle-backend-1.0.0/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/cdp-seattle-backend-1.0.0/setup.py-expected.json new file mode 100644 index 00000000000..02df99564be --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/cdp-seattle-backend-1.0.0/setup.py-expected.json @@ -0,0 +1,106 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "cdp-seattle-backend", + "version": "1.0.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Package containing the gather functions for Example.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Council Data Project Contributors", + "email": null, + "url": null + } + ], + "keywords": [ + "civic technology", + "open government", + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python :: 3.9" + ], + "homepage_url": "https://github.com/CouncilDataProject/seattle", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT license", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=3.9" + }, + "dependencies": [ + { + "purl": "pkg:pypi/cdp-backend@3.0.16", + "extracted_requirement": "cdp-backend[pipeline]==3.0.16", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/cdp-scrapers", + "extracted_requirement": "cdp-scrapers>=0.4.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/black", + "extracted_requirement": "black>=19.10b0", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/flake8", + "extracted_requirement": "flake8>=3.8.3", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/flake8-debugger", + "extracted_requirement": "flake8-debugger>=3.2.1", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/cdp-seattle-backend", + "repository_download_url": "https://pypi.org/packages/source/c/cdp-seattle-backend/cdp-seattle-backend-1.0.0.tar.gz", + "api_data_url": "https://pypi.org/pypi/cdp-seattle-backend/1.0.0/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/cdp-seattle-backend@1.0.0" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py b/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py index f6e3d103ebf..3fcc735fac5 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py +++ b/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py @@ -62,6 +62,7 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8' ], + download_url='https://github.com/certifi/python-certifi', project_urls={ 'Documentation': 'https://certifiio.readthedocs.io/en/latest/', 'Source': 'https://github.com/certifi/python-certifi', diff --git a/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py-expected-args.json new file mode 100644 index 00000000000..a4d14f0b547 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py-expected-args.json @@ -0,0 +1,30 @@ +{ + "name": "certifi", + "description": "Python package for providing Mozilla's CA Bundle.", + "author": "Kenneth Reitz", + "author_email": "me@kennethreitz.com", + "url": "https://certifiio.readthedocs.io/en/latest/", + "package_dir": { + "certifi": "certifi" + }, + "license": "MPL-2.0", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8" + ], + "download_url": "https://github.com/certifi/python-certifi", + "project_urls": { + "Documentation": "https://certifiio.readthedocs.io/en/latest/", + "Source": "https://github.com/certifi/python-certifi" + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py-expected.json index dd38fd28989..d13f42ab47f 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py-expected.json @@ -1,58 +1,66 @@ -{ - "type": "pypi", - "namespace": null, - "name": "certifi", - "version": "2020.06.20", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "Python package for providing Mozilla's CA Bundle.", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Kenneth Reitz", - "email": "me@kennethreitz.com", - "url": "https://certifiio.readthedocs.io/en/latest/" - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Natural Language :: English", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8" - ], - "homepage_url": "https://certifiio.readthedocs.io/en/latest/", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "MPL-2.0", - "classifiers": [ - "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)" - ] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/certifi@2020.06.20", - "repository_homepage_url": "https://pypi.org/project/certifi", - "repository_download_url": "https://pypi.io/packages/source/c/certifi/certifi-2020.06.20.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/certifi/2020.06.20/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "certifi", + "version": "2020.06.20", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Python package for providing Mozilla's CA Bundle.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Kenneth Reitz", + "email": "me@kennethreitz.com", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8" + ], + "homepage_url": "https://certifiio.readthedocs.io/en/latest/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": "https://github.com/certifi/python-certifi", + "vcs_url": null, + "copyright": null, + "license_expression": "mpl-2.0", + "declared_license": { + "license": "MPL-2.0", + "classifiers": [ + "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "Documentation": "https://certifiio.readthedocs.io/en/latest/", + "Download-URL": "https://github.com/certifi/python-certifi" + }, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/certifi", + "repository_download_url": "https://pypi.org/packages/source/c/certifi/certifi-2020.06.20.tar.gz", + "api_data_url": "https://pypi.org/pypi/certifi/2020.06.20/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/certifi@2020.06.20" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/cffi-1.14.0/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/cffi-1.14.0/setup.py-expected-args.json new file mode 100644 index 00000000000..72a29a01506 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/cffi-1.14.0/setup.py-expected-args.json @@ -0,0 +1,25 @@ +{ + "name": "cffi", + "description": "Foreign Function Interface for Python calling C code.", + "long_description": "\nCFFI\n====\n\nForeign Function Interface for Python calling C code.\nPlease see the `Documentation <http://cffi.readthedocs.org/>`_.\n\nContact\n-------\n\n`Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_\n", + "version": "1.14.0", + "url": "http://cffi.readthedocs.org", + "author": "Armin Rigo, Maciej Fijalkowski", + "author_email": "python-cffi@googlegroups.com", + "license": "MIT", + "classifiers": [ + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "License :: OSI Approved :: MIT License" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/cffi-1.14.0/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/cffi-1.14.0/setup.py-expected.json index 9e26dfeeb6e..33d77a55198 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/cffi-1.14.0/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/cffi-1.14.0/setup.py-expected.json @@ -1 +1,64 @@ -{} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "cffi", + "version": "1.14.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Foreign Function Interface for Python calling C code.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Armin Rigo, Maciej Fijalkowski", + "email": "python-cffi@googlegroups.com", + "url": null + } + ], + "keywords": [ + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy" + ], + "homepage_url": "http://cffi.readthedocs.org", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/cffi", + "repository_download_url": "https://pypi.org/packages/source/c/cffi/cffi-1.14.0.tar.gz", + "api_data_url": "https://pypi.org/pypi/cffi/1.14.0/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/cffi@1.14.0" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/chardet-3.0.4/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/chardet-3.0.4/setup.py-expected-args.json new file mode 100644 index 00000000000..e4867a1ab45 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/chardet-3.0.4/setup.py-expected-args.json @@ -0,0 +1,36 @@ +{ + "name": "chardet", + "description": "Universal encoding detector for Python 2 and 3", + "author": "Mark Pilgrim", + "author_email": "mark@diveintomark.org", + "maintainer": "Daniel Blanchard", + "maintainer_email": "dan.blanchard@gmail.com", + "url": "https://github.com/chardet/chardet", + "license": "LGPL", + "keywords": [ + "encoding", + "i18n", + "xml" + ], + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Linguistic" + ], + "tests_require": [ + "pytest", + "hypothesis" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/chardet-3.0.4/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/chardet-3.0.4/setup.py-expected.json index f139ac63d8d..97ad9cfe390 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/chardet-3.0.4/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/chardet-3.0.4/setup.py-expected.json @@ -1,61 +1,76 @@ -{ - "type": "pypi", - "namespace": null, - "name": "chardet", - "version": "3.0.4", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "Universal encoding detector for Python 2 and 3", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Mark Pilgrim", - "email": "mark@diveintomark.org", - "url": "https://github.com/chardet/chardet" - } - ], - "keywords": [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.6", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Text Processing :: Linguistic" - ], - "homepage_url": "https://github.com/chardet/chardet", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "LGPL", - "classifiers": [ - "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)" - ] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/chardet@3.0.4", - "repository_homepage_url": "https://pypi.org/project/chardet", - "repository_download_url": "https://pypi.io/packages/source/c/chardet/chardet-3.0.4.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/chardet/3.0.4/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "chardet", + "version": "3.0.4", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Universal encoding detector for Python 2 and 3", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Mark Pilgrim", + "email": "mark@diveintomark.org", + "url": null + }, + { + "type": "person", + "role": "maintainer", + "name": "Daniel Blanchard", + "email": "dan.blanchard@gmail.com", + "url": null + } + ], + "keywords": [ + "encoding", + "i18n", + "xml", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Linguistic" + ], + "homepage_url": "https://github.com/chardet/chardet", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "lgpl-2.0-plus", + "declared_license": { + "license": "LGPL", + "classifiers": [ + "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/chardet", + "repository_download_url": "https://pypi.org/packages/source/c/chardet/chardet-3.0.4.tar.gz", + "api_data_url": "https://pypi.org/pypi/chardet/3.0.4/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/chardet@3.0.4" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/docutils-0.16/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/docutils-0.16/setup.py-expected-args.json new file mode 100644 index 00000000000..6da2c1f2992 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/docutils-0.16/setup.py-expected-args.json @@ -0,0 +1,66 @@ +{ + "name": "docutils", + "description": "Docutils -- Python Documentation Utilities", + "long_description": "Docutils is a modular system for processing documentation\ninto useful formats, such as HTML, XML, and LaTeX. For\ninput Docutils supports reStructuredText, an easy-to-read,\nwhat-you-see-is-what-you-get plaintext markup syntax.", + "url": "http://docutils.sourceforge.net/", + "version": "0.16", + "author": "David Goodger", + "author_email": "goodger@python.org", + "maintainer": "docutils-develop list", + "maintainer_email": "docutils-develop@lists.sourceforge.net", + "license": "public domain, Python, 2-Clause BSD, GPL 3 (see COPYING.txt)", + "platforms": "OS-independent", + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", + "package_dir": { + "docutils": "docutils", + "docutils.tools": "tools" + }, + "classifiers": [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: End Users/Desktop", + "Intended Audience :: Other Audience", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: Public Domain", + "License :: OSI Approved :: Python Software Foundation License", + "License :: OSI Approved :: BSD License", + "License :: OSI Approved :: GNU General Public License (GPL)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Topic :: Documentation", + "Topic :: Software Development :: Documentation", + "Topic :: Text Processing", + "Natural Language :: English", + "Natural Language :: Afrikaans", + "Natural Language :: Catalan", + "Natural Language :: Chinese (Simplified)", + "Natural Language :: Chinese (Traditional)", + "Natural Language :: Czech", + "Natural Language :: Danish", + "Natural Language :: Dutch", + "Natural Language :: Esperanto", + "Natural Language :: Finnish", + "Natural Language :: French", + "Natural Language :: Galician", + "Natural Language :: German", + "Natural Language :: Hebrew", + "Natural Language :: Italian", + "Natural Language :: Japanese", + "Natural Language :: Korean", + "Natural Language :: Latvian", + "Natural Language :: Lithuanian", + "Natural Language :: Persian", + "Natural Language :: Polish", + "Natural Language :: Portuguese (Brazilian)", + "Natural Language :: Russian", + "Natural Language :: Slovak", + "Natural Language :: Spanish", + "Natural Language :: Swedish" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/docutils-0.16/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/docutils-0.16/setup.py-expected.json index 9e26dfeeb6e..367897cf9e6 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/docutils-0.16/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/docutils-0.16/setup.py-expected.json @@ -1 +1,106 @@ -{} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "docutils", + "version": "0.16", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Docutils -- Python Documentation Utilities", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "David Goodger", + "email": "goodger@python.org", + "url": null + }, + { + "type": "person", + "role": "maintainer", + "name": "docutils-develop list", + "email": "docutils-develop@lists.sourceforge.net", + "url": null + } + ], + "keywords": [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: End Users/Desktop", + "Intended Audience :: Other Audience", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Operating System :: OS Independent", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Topic :: Documentation", + "Topic :: Software Development :: Documentation", + "Topic :: Text Processing", + "Natural Language :: English", + "Natural Language :: Afrikaans", + "Natural Language :: Catalan", + "Natural Language :: Chinese (Simplified)", + "Natural Language :: Chinese (Traditional)", + "Natural Language :: Czech", + "Natural Language :: Danish", + "Natural Language :: Dutch", + "Natural Language :: Esperanto", + "Natural Language :: Finnish", + "Natural Language :: French", + "Natural Language :: Galician", + "Natural Language :: German", + "Natural Language :: Hebrew", + "Natural Language :: Italian", + "Natural Language :: Japanese", + "Natural Language :: Korean", + "Natural Language :: Latvian", + "Natural Language :: Lithuanian", + "Natural Language :: Persian", + "Natural Language :: Polish", + "Natural Language :: Portuguese (Brazilian)", + "Natural Language :: Russian", + "Natural Language :: Slovak", + "Natural Language :: Spanish", + "Natural Language :: Swedish" + ], + "homepage_url": "http://docutils.sourceforge.net/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "(public-domain AND python AND bsd-simplified AND gpl-3.0) AND public-domain AND python AND bsd-new AND gpl-1.0-plus", + "declared_license": { + "license": "public domain, Python, 2-Clause BSD, GPL 3 (see COPYING.txt)", + "classifiers": [ + "License :: Public Domain", + "License :: OSI Approved :: Python Software Foundation License", + "License :: OSI Approved :: BSD License", + "License :: OSI Approved :: GNU General Public License (GPL)" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + }, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/docutils", + "repository_download_url": "https://pypi.org/packages/source/d/docutils/docutils-0.16.tar.gz", + "api_data_url": "https://pypi.org/pypi/docutils/0.16/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/docutils@0.16" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.cfg b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.cfg new file mode 100644 index 00000000000..e858d13a205 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.cfg @@ -0,0 +1,121 @@ +[metadata] +name = Flask +version = attr: flask.__version__ +url = https://palletsprojects.com/p/flask +project_urls = + Donate = https://palletsprojects.com/donate + Documentation = https://flask.palletsprojects.com/ + Changes = https://flask.palletsprojects.com/changes/ + Source Code = https://github.com/pallets/flask/ + Issue Tracker = https://github.com/pallets/flask/issues/ + Twitter = https://twitter.com/PalletsTeam + Chat = https://discord.gg/pallets +license = BSD-3-Clause +author = Armin Ronacher +author_email = armin.ronacher@active-4.com +maintainer = Pallets +maintainer_email = contact@palletsprojects.com +description = A simple framework for building complex web applications. +long_description = file: README.rst +long_description_content_type = text/x-rst +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Web Environment + Framework :: Flask + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Topic :: Internet :: WWW/HTTP :: Dynamic Content + Topic :: Internet :: WWW/HTTP :: WSGI + Topic :: Internet :: WWW/HTTP :: WSGI :: Application + Topic :: Software Development :: Libraries :: Application Frameworks + +[options] +packages = find: +package_dir = = src +include_package_data = True +python_requires = >= 3.7 +# Dependencies are in setup.py for GitHub's dependency graph. + +[options.packages.find] +where = src + +[options.entry_points] +console_scripts = + flask = flask.cli:main + +[tool:pytest] +testpaths = tests +filterwarnings = + error + +[coverage:run] +branch = True +source = + flask + tests + +[coverage:paths] +source = + src + */site-packages + +[flake8] +# B = bugbear +# E = pycodestyle errors +# F = flake8 pyflakes +# W = pycodestyle warnings +# B9 = bugbear opinions +# ISC = implicit str concat +select = B, E, F, W, B9, ISC +ignore = + # slice notation whitespace, invalid + E203 + # import at top, too many circular import fixes + E402 + # line length, handled by bugbear B950 + E501 + # bare except, handled by bugbear B001 + E722 + # bin op line break, invalid + W503 +# up to 88 allowed by bugbear B950 +max-line-length = 80 +per-file-ignores = + # __init__ exports names + src/flask/__init__.py: F401 + +[mypy] +files = src/flask, tests/typing +python_version = 3.7 +show_error_codes = True +allow_redefinition = True +disallow_subclassing_any = True +# disallow_untyped_calls = True +# disallow_untyped_defs = True +# disallow_incomplete_defs = True +no_implicit_optional = True +local_partial_types = True +# no_implicit_reexport = True +strict_equality = True +warn_redundant_casts = True +warn_unused_configs = True +warn_unused_ignores = True +# warn_return_any = True +# warn_unreachable = True + +[mypy-asgiref.*] +ignore_missing_imports = True + +[mypy-blinker.*] +ignore_missing_imports = True + +[mypy-dotenv.*] +ignore_missing_imports = True + +[mypy-cryptography.*] +ignore_missing_imports = True + +[mypy-importlib_metadata] +ignore_missing_imports = True diff --git a/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.py b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.py new file mode 100644 index 00000000000..a28763b56cd --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.py @@ -0,0 +1,17 @@ +from setuptools import setup + +# Metadata goes in setup.cfg. These are here for GitHub's dependency graph. +setup( + name="Flask", + install_requires=[ + "Werkzeug >= 2.0", + "Jinja2 >= 3.0", + "itsdangerous >= 2.0", + "click >= 8.0", + "importlib-metadata >= 3.6.0; python_version < '3.10'", + ], + extras_require={ + "async": ["asgiref >= 3.2"], + "dotenv": ["python-dotenv"], + }, +) diff --git a/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.py-expected-args.json new file mode 100644 index 00000000000..a350cd28b30 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.py-expected-args.json @@ -0,0 +1,18 @@ +{ + "name": "Flask", + "install_requires": [ + "Werkzeug >= 2.0", + "Jinja2 >= 3.0", + "itsdangerous >= 2.0", + "click >= 8.0", + "importlib-metadata >= 3.6.0; python_version < '3.10'" + ], + "extras_require": { + "async": [ + "asgiref >= 3.2" + ], + "dotenv": [ + "python-dotenv" + ] + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.py-expected.json new file mode 100644 index 00000000000..bf5b3fd86e8 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/setup.py-expected.json @@ -0,0 +1,102 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "Flask", + "version": "2.2.0.dev0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "", + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": {}, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:pypi/werkzeug", + "extracted_requirement": "Werkzeug>=2.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/jinja2", + "extracted_requirement": "Jinja2>=3.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/itsdangerous", + "extracted_requirement": "itsdangerous>=2.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/click", + "extracted_requirement": "click>=8.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/importlib-metadata", + "extracted_requirement": "importlib-metadata>=3.6.0; python_version < \"3.10\"", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/asgiref", + "extracted_requirement": "asgiref>=3.2", + "scope": "async", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/python-dotenv", + "extracted_requirement": "python-dotenv", + "scope": "dotenv", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/Flask", + "repository_download_url": "https://pypi.org/packages/source/F/Flask/Flask-2.2.0.dev0.tar.gz", + "api_data_url": "https://pypi.org/pypi/Flask/2.2.0.dev0/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/flask@2.2.0.dev0" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/src/flask/__init__.py b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/src/flask/__init__.py new file mode 100644 index 00000000000..bc93e0a34be --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/flask-2.2.0.dev0/src/flask/__init__.py @@ -0,0 +1,45 @@ +from markupsafe import escape +from markupsafe import Markup + +from . import json as json +from .app import Flask as Flask +from .app import Request as Request +from .app import Response as Response +from .blueprints import Blueprint as Blueprint +from .config import Config as Config +from .ctx import after_this_request as after_this_request +from .ctx import copy_current_request_context as copy_current_request_context +from .ctx import has_app_context as has_app_context +from .ctx import has_request_context as has_request_context +from .globals import _app_ctx_stack as _app_ctx_stack +from .globals import _request_ctx_stack as _request_ctx_stack +from .globals import current_app as current_app +from .globals import g as g +from .globals import request as request +from .globals import session as session +from .helpers import abort as abort +from .helpers import flash as flash +from .helpers import get_flashed_messages as get_flashed_messages +from .helpers import get_template_attribute as get_template_attribute +from .helpers import make_response as make_response +from .helpers import redirect as redirect +from .helpers import send_file as send_file +from .helpers import send_from_directory as send_from_directory +from .helpers import stream_with_context as stream_with_context +from .helpers import url_for as url_for +from .json import jsonify as jsonify +from .signals import appcontext_popped as appcontext_popped +from .signals import appcontext_pushed as appcontext_pushed +from .signals import appcontext_tearing_down as appcontext_tearing_down +from .signals import before_render_template as before_render_template +from .signals import got_request_exception as got_request_exception +from .signals import message_flashed as message_flashed +from .signals import request_finished as request_finished +from .signals import request_started as request_started +from .signals import request_tearing_down as request_tearing_down +from .signals import signals_available as signals_available +from .signals import template_rendered as template_rendered +from .templating import render_template as render_template +from .templating import render_template_string as render_template_string + +__version__ = "2.2.0.dev0" diff --git a/tests/packagedcode/data/pypi/setup.py-versions/flit-2.3.0/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/flit-2.3.0/setup.py-expected-args.json new file mode 100644 index 00000000000..f2970026cef --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/flit-2.3.0/setup.py-expected-args.json @@ -0,0 +1,34 @@ +{ + "name": "flit", + "version": "2.3.0", + "description": "A simple packaging tool for simple packages.", + "author": "Thomas Kluyver", + "author_email": "thomas@kluyver.me.uk", + "url": "https://github.com/takluyver/flit", + "install_requires": [ + "flit_core>=2.3.0", + "requests", + "docutils", + "pytoml" + ], + "extras_require": { + ":python_version in '3.3 3.4 3.5'": [ + "zipfile36" + ], + "doc": [ + "sphinx", + "sphinxcontrib_github_alt", + "pygments-github-lexers" + ], + "installfrom": [ + "requests_download" + ], + "test": [ + "testpath", + "responses", + "pytest>=2.7.3", + "pytest-cov" + ] + }, + "python_requires": ">=3.5" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/flit-2.3.0/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/flit-2.3.0/setup.py-expected.json index acf83c7e405..ef43b9d67f6 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/flit-2.3.0/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/flit-2.3.0/setup.py-expected.json @@ -1,44 +1,166 @@ -{ - "type": "pypi", - "namespace": null, - "name": "flit", - "version": "2.3.0", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "A simple packaging tool for simple packages.", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Thomas Kluyver", - "email": "thomas@kluyver.me.uk", - "url": "https://github.com/takluyver/flit" - } - ], - "keywords": [], - "homepage_url": "https://github.com/takluyver/flit", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": null, - "classifiers": [] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/flit@2.3.0", - "repository_homepage_url": "https://pypi.org/project/flit", - "repository_download_url": "https://pypi.io/packages/source/f/flit/flit-2.3.0.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/flit/2.3.0/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "flit", + "version": "2.3.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "A simple packaging tool for simple packages.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Thomas Kluyver", + "email": "thomas@kluyver.me.uk", + "url": null + } + ], + "keywords": [], + "homepage_url": "https://github.com/takluyver/flit", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": {}, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=3.5" + }, + "dependencies": [ + { + "purl": "pkg:pypi/flit-core", + "extracted_requirement": "flit_core>=2.3.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/requests", + "extracted_requirement": "requests", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/docutils", + "extracted_requirement": "docutils", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pytoml", + "extracted_requirement": "pytoml", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/zipfile36", + "extracted_requirement": "zipfile36", + "scope": ":python_version in '3.3 3.4 3.5'", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/sphinx", + "extracted_requirement": "sphinx", + "scope": "doc", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/sphinxcontrib-github-alt", + "extracted_requirement": "sphinxcontrib_github_alt", + "scope": "doc", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pygments-github-lexers", + "extracted_requirement": "pygments-github-lexers", + "scope": "doc", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/requests-download", + "extracted_requirement": "requests_download", + "scope": "installfrom", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/testpath", + "extracted_requirement": "testpath", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/responses", + "extracted_requirement": "responses", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pytest", + "extracted_requirement": "pytest>=2.7.3", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pytest-cov", + "extracted_requirement": "pytest-cov", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/flit", + "repository_download_url": "https://pypi.org/packages/source/f/flit/flit-2.3.0.tar.gz", + "api_data_url": "https://pypi.org/pypi/flit/2.3.0/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/flit@2.3.0" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/idna-2.9/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/idna-2.9/setup.py-expected-args.json new file mode 100644 index 00000000000..10ac3f47be1 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/idna-2.9/setup.py-expected-args.json @@ -0,0 +1,30 @@ +{ + "name": "idna", + "description": "Internationalized Domain Names in Applications (IDNA)", + "author": "Kim Davies", + "author_email": "kim@cynosure.com.au", + "license": "BSD-like", + "url": "https://github.com/kjd/idna", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Internet :: Name Service (DNS)", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Utilities" + ], + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/idna-2.9/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/idna-2.9/setup.py-expected.json index 9e26dfeeb6e..8d69c3c51d5 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/idna-2.9/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/idna-2.9/setup.py-expected.json @@ -1 +1,72 @@ -{} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "idna", + "version": "2.9", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Internationalized Domain Names in Applications (IDNA)", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Kim Davies", + "email": "kim@cynosure.com.au", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Internet :: Name Service (DNS)", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Utilities" + ], + "homepage_url": "https://github.com/kjd/idna", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "other-permissive AND bsd-new", + "declared_license": { + "license": "BSD-like", + "classifiers": [ + "License :: OSI Approved :: BSD License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + }, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/idna", + "repository_download_url": "https://pypi.org/packages/source/i/idna/idna-2.9.tar.gz", + "api_data_url": "https://pypi.org/pypi/idna/2.9/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/idna@2.9" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/numpy/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/numpy/setup.py-expected-args.json new file mode 100644 index 00000000000..9e26dfeeb6e --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/numpy/setup.py-expected-args.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/numpy/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/numpy/setup.py-expected.json index 9e26dfeeb6e..16467fca398 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/numpy/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/numpy/setup.py-expected.json @@ -1 +1,38 @@ -{} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": null, + "version": "1.19.2", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "", + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": {}, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "pypi_setup_py", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/setup.py-expected-args.json new file mode 100644 index 00000000000..9e26dfeeb6e --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/setup.py-expected-args.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/setup.py-expected.json index 9e26dfeeb6e..16467fca398 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/numpy-1.19.2/setup.py-expected.json @@ -1 +1,38 @@ -{} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": null, + "version": "1.19.2", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "", + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": {}, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "pypi_setup_py", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/paho-mqtt-1.5.0/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/paho-mqtt-1.5.0/setup.py-expected-args.json new file mode 100644 index 00000000000..41ff7ece4d4 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/paho-mqtt-1.5.0/setup.py-expected-args.json @@ -0,0 +1,42 @@ +{ + "name": "paho-mqtt", + "description": "MQTT version 3.1.1 client class", + "author": "Roger Light", + "author_email": "roger@atchoo.org", + "url": "http://eclipse.org/paho", + "package_dir": { + "": "src" + }, + "license": "Eclipse Public License v1.0 / Eclipse Distribution License v1.0", + "keywords": [ + "paho" + ], + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Topic :: Communications", + "Topic :: Internet" + ], + "tests_require": [ + "pytest", + "pylama", + "six" + ], + "extras_require": { + "proxy": [ + "PySocks" + ] + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/paho-mqtt-1.5.0/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/paho-mqtt-1.5.0/setup.py-expected.json index 361a596ef28..0ae0f35ac82 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/paho-mqtt-1.5.0/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/paho-mqtt-1.5.0/setup.py-expected.json @@ -1,62 +1,78 @@ -{ - "type": "pypi", - "namespace": null, - "name": "paho-mqtt", - "version": "1.5.0", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "MQTT version 3.1.1 client class", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Roger Light", - "email": "roger@atchoo.org", - "url": "http://eclipse.org/paho" - } - ], - "keywords": [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Operating System :: MacOS :: MacOS X", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Natural Language :: English", - "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Topic :: Communications", - "Topic :: Internet" - ], - "homepage_url": "http://eclipse.org/paho", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "Eclipse Public License v1.0 / Eclipse Distribution License v1.0", - "classifiers": [ - "License :: OSI Approved" - ] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/paho-mqtt@1.5.0", - "repository_homepage_url": "https://pypi.org/project/paho-mqtt", - "repository_download_url": "https://pypi.io/packages/source/p/paho-mqtt/paho-mqtt-1.5.0.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/paho-mqtt/1.5.0/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "paho-mqtt", + "version": "1.5.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "MQTT version 3.1.1 client class", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Roger Light", + "email": "roger@atchoo.org", + "url": null + } + ], + "keywords": [ + "paho", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Topic :: Communications", + "Topic :: Internet" + ], + "homepage_url": "http://eclipse.org/paho", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "((epl-1.0 AND bsd-new) AND unknown) AND free-unknown", + "declared_license": { + "license": "Eclipse Public License v1.0 / Eclipse Distribution License v1.0", + "classifiers": [ + "License :: OSI Approved" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:pypi/pysocks", + "extracted_requirement": "PySocks", + "scope": "proxy", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/paho-mqtt", + "repository_download_url": "https://pypi.org/packages/source/p/paho-mqtt/paho-mqtt-1.5.0.tar.gz", + "api_data_url": "https://pypi.org/pypi/paho-mqtt/1.5.0/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/paho-mqtt@1.5.0" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pexpect-4.6.0/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/pexpect-4.6.0/setup.py-expected-args.json new file mode 100644 index 00000000000..15597fa9ae4 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/pexpect-4.6.0/setup.py-expected-args.json @@ -0,0 +1,35 @@ +{ + "name": "pexpect", + "description": "Pexpect allows easy control of interactive console applications.", + "long_description": "\nPexpect is a pure Python module for spawning child applications; controlling\nthem; and responding to expected patterns in their output. Pexpect works like\nDon Libes' Expect. Pexpect allows your script to spawn a child application and\ncontrol it as if a human were typing commands.\n\nPexpect can be used for automating interactive applications such as ssh, ftp,\npasswd, telnet, etc. It can be used to a automate setup scripts for duplicating\nsoftware package installations on different servers. It can be used for\nautomated software testing. Pexpect is in the spirit of Don Libes' Expect, but\nPexpect is pure Python.\n\nThe main features of Pexpect require the pty module in the Python standard\nlibrary, which is only available on Unix-like systems. Some features\u2014waiting\nfor patterns from file descriptors or subprocesses\u2014are also available on\nWindows.\n", + "author": "Noah Spurrier; Thomas Kluyver; Jeff Quast", + "author_email": "noah@noah.org, thomas@kluyver.me.uk, contact@jeffquast.com", + "url": "https://pexpect.readthedocs.io/", + "license": "ISC license", + "platforms": "UNIX", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: ISC License (ISCL)", + "Operating System :: POSIX", + "Operating System :: MacOS :: MacOS X", + "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Topic :: Software Development", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Quality Assurance", + "Topic :: Software Development :: Testing", + "Topic :: System", + "Topic :: System :: Archiving :: Packaging", + "Topic :: System :: Installation/Setup", + "Topic :: System :: Shells", + "Topic :: System :: Software Distribution", + "Topic :: Terminals" + ], + "install_requires": [ + "ptyprocess>=0.5" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pexpect-4.6.0/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/pexpect-4.6.0/setup.py-expected.json index 9be8503d15a..c15ae6953c2 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/pexpect-4.6.0/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/pexpect-4.6.0/setup.py-expected.json @@ -1,66 +1,81 @@ -{ - "type": "pypi", - "namespace": null, - "name": "pexpect", - "version": "4.6.0", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "Pexpect allows easy control of interactive console applications.", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Noah Spurrier; Thomas Kluyver; Jeff Quast", - "email": "noah@noah.org, thomas@kluyver.me.uk, contact@jeffquast.com", - "url": "https://pexpect.readthedocs.io/" - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "Intended Audience :: System Administrators", - "Operating System :: POSIX", - "Operating System :: MacOS :: MacOS X", - "Programming Language :: Python", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Topic :: Software Development", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Software Development :: Quality Assurance", - "Topic :: Software Development :: Testing", - "Topic :: System", - "Topic :: System :: Archiving :: Packaging", - "Topic :: System :: Installation/Setup", - "Topic :: System :: Shells", - "Topic :: System :: Software Distribution", - "Topic :: Terminals" - ], - "homepage_url": "https://pexpect.readthedocs.io/", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "ISC license", - "classifiers": [ - "License :: OSI Approved :: ISC License (ISCL)" - ] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/pexpect@4.6.0", - "repository_homepage_url": "https://pypi.org/project/pexpect", - "repository_download_url": "https://pypi.io/packages/source/p/pexpect/pexpect-4.6.0.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/pexpect/4.6.0/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "pexpect", + "version": "4.6.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Pexpect allows easy control of interactive console applications.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Noah Spurrier; Thomas Kluyver; Jeff Quast", + "email": "noah@noah.org, thomas@kluyver.me.uk, contact@jeffquast.com", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Operating System :: POSIX", + "Operating System :: MacOS :: MacOS X", + "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Topic :: Software Development", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Quality Assurance", + "Topic :: Software Development :: Testing", + "Topic :: System", + "Topic :: System :: Archiving :: Packaging", + "Topic :: System :: Installation/Setup", + "Topic :: System :: Shells", + "Topic :: System :: Software Distribution", + "Topic :: Terminals" + ], + "homepage_url": "https://pexpect.readthedocs.io/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "isc", + "declared_license": { + "license": "ISC license", + "classifiers": [ + "License :: OSI Approved :: ISC License (ISCL)" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:pypi/ptyprocess", + "extracted_requirement": "ptyprocess>=0.5", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/pexpect", + "repository_download_url": "https://pypi.org/packages/source/p/pexpect/pexpect-4.6.0.tar.gz", + "api_data_url": "https://pypi.org/pypi/pexpect/4.6.0/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/pexpect@4.6.0" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pip-22.0.4/setup.py b/tests/packagedcode/data/pypi/setup.py-versions/pip-22.0.4/setup.py new file mode 100644 index 00000000000..fbb6a48a69c --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/pip-22.0.4/setup.py @@ -0,0 +1,84 @@ +import os +import sys + +from setuptools import find_packages, setup + + +def read(rel_path: str) -> str: + here = os.path.abspath(os.path.dirname(__file__)) + # intentionally *not* adding an encoding option to open, See: + # https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690 + with open(os.path.join(here, rel_path)) as fp: + return fp.read() + + +def get_version(rel_path: str) -> str: + for line in read(rel_path).splitlines(): + if line.startswith("__version__"): + # __version__ = "0.9" + delim = '"' if '"' in line else "'" + return line.split(delim)[1] + raise RuntimeError("Unable to find version string.") + + +long_description = read("README.rst") + +setup( + name="pip", + version=get_version("src/pip/__init__.py"), + description="The PyPA recommended tool for installing Python packages.", + long_description=long_description, + license="MIT", + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Build Tools", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + ], + url="https://pip.pypa.io/", + project_urls={ + "Documentation": "https://pip.pypa.io", + "Source": "https://github.com/pypa/pip", + "Changelog": "https://pip.pypa.io/en/stable/news/", + }, + author="The pip developers", + author_email="distutils-sig@python.org", + package_dir={"": "src"}, + packages=find_packages( + where="src", + exclude=["contrib", "docs", "tests*", "tasks"], + ), + package_data={ + "pip": ["py.typed"], + "pip._vendor": ["vendor.txt"], + "pip._vendor.certifi": ["*.pem"], + "pip._vendor.requests": ["*.pem"], + "pip._vendor.distlib._backport": ["sysconfig.cfg"], + "pip._vendor.distlib": [ + "t32.exe", + "t64.exe", + "t64-arm.exe", + "w32.exe", + "w64.exe", + "w64-arm.exe", + ], + }, + entry_points={ + "console_scripts": [ + "pip=pip._internal.cli.main:main", + "pip{}=pip._internal.cli.main:main".format(sys.version_info[0]), + "pip{}.{}=pip._internal.cli.main:main".format(*sys.version_info[:2]), + ], + }, + zip_safe=False, + python_requires=">=3.7", +) diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pip-22.0.4/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/pip-22.0.4/setup.py-expected-args.json new file mode 100644 index 00000000000..412f99fe61d --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/pip-22.0.4/setup.py-expected-args.json @@ -0,0 +1,32 @@ +{ + "name": "pip", + "description": "The PyPA recommended tool for installing Python packages.", + "license": "MIT", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Build Tools", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy" + ], + "url": "https://pip.pypa.io/", + "project_urls": { + "Documentation": "https://pip.pypa.io", + "Source": "https://github.com/pypa/pip", + "Changelog": "https://pip.pypa.io/en/stable/news/" + }, + "author": "The pip developers", + "author_email": "distutils-sig@python.org", + "package_dir": { + "": "src" + }, + "python_requires": ">=3.7" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pip-22.0.4/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/pip-22.0.4/setup.py-expected.json new file mode 100644 index 00000000000..98fde0260fd --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/pip-22.0.4/setup.py-expected.json @@ -0,0 +1,68 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "pip", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "The PyPA recommended tool for installing Python packages.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "The pip developers", + "email": "distutils-sig@python.org", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Build Tools", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy" + ], + "homepage_url": "https://pip.pypa.io/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": "https://github.com/pypa/pip", + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "Documentation": "https://pip.pypa.io", + "Changelog": "https://pip.pypa.io/en/stable/news/", + "python_requires": ">=3.7" + }, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/pip", + "repository_download_url": null, + "api_data_url": "https://pypi.org/pypi/pip/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/pip" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pycparser-2.20/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/pycparser-2.20/setup.py-expected-args.json new file mode 100644 index 00000000000..ffee68d42d7 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/pycparser-2.20/setup.py-expected-args.json @@ -0,0 +1,23 @@ +{ + "name": "pycparser", + "description": "C parser in Python", + "long_description": "\n pycparser is a complete parser of the C language, written in\n pure Python using the PLY parsing library.\n It parses C code into an AST and can serve as a front-end for\n C compilers or analysis tools.\n ", + "license": "BSD", + "version": "2.20", + "author": "Eli Bendersky", + "maintainer": "Eli Bendersky", + "author_email": "eliben@gmail.com", + "url": "https://github.com/eliben/pycparser", + "platforms": "Cross Platform", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6" + ], + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pycparser-2.20/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/pycparser-2.20/setup.py-expected.json index db71d8ada9d..a9f2ad712a7 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/pycparser-2.20/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/pycparser-2.20/setup.py-expected.json @@ -1,54 +1,68 @@ -{ - "type": "pypi", - "namespace": null, - "name": "pycparser", - "version": "2.20", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "C parser in Python", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Eli Bendersky", - "email": "eliben@gmail.com", - "url": "https://github.com/eliben/pycparser" - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6" - ], - "homepage_url": "https://github.com/eliben/pycparser", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "BSD", - "classifiers": [ - "License :: OSI Approved :: BSD License" - ] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/pycparser@2.20", - "repository_homepage_url": "https://pypi.org/project/pycparser", - "repository_download_url": "https://pypi.io/packages/source/p/pycparser/pycparser-2.20.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/pycparser/2.20/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "pycparser", + "version": "2.20", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "C parser in Python", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Eli Bendersky", + "email": "eliben@gmail.com", + "url": null + }, + { + "type": "person", + "role": "maintainer", + "name": "Eli Bendersky", + "email": null, + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6" + ], + "homepage_url": "https://github.com/eliben/pycparser", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "unknown AND bsd-new", + "declared_license": { + "license": "BSD", + "classifiers": [ + "License :: OSI Approved :: BSD License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + }, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/pycparser", + "repository_download_url": "https://pypi.org/packages/source/p/pycparser/pycparser-2.20.tar.gz", + "api_data_url": "https://pypi.org/pypi/pycparser/2.20/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/pycparser@2.20" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pyserial-3.4/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/pyserial-3.4/setup.py-expected-args.json new file mode 100644 index 00000000000..52fb3978a1a --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/pyserial-3.4/setup.py-expected-args.json @@ -0,0 +1,33 @@ +{ + "name": "pyserial", + "description": "Python Serial Port Extension", + "author": "Chris Liechti", + "author_email": "cliechti@gmx.net", + "url": "https://github.com/pyserial/pyserial", + "license": "BSD", + "long_description": "Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython\n\nStable:\n\n- Documentation: http://pythonhosted.org/pyserial/\n- Download Page: https://pypi.python.org/pypi/pyserial\n\nLatest:\n\n- Documentation: http://pyserial.readthedocs.io/en/latest/\n- Project Homepage: https://github.com/pyserial/pyserial\n", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Operating System :: POSIX", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS :: MacOS X", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Topic :: Communications", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Terminals :: Serial" + ], + "platforms": "any" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pyserial-3.4/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/pyserial-3.4/setup.py-expected.json index 73e763618de..2b88ffbeee3 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/pyserial-3.4/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/pyserial-3.4/setup.py-expected.json @@ -1,67 +1,72 @@ -{ - "type": "pypi", - "namespace": null, - "name": "pyserial", - "version": "3.4", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "Python Serial Port Extension", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Chris Liechti", - "email": "cliechti@gmx.net", - "url": "https://github.com/pyserial/pyserial" - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Intended Audience :: End Users/Desktop", - "Natural Language :: English", - "Operating System :: POSIX", - "Operating System :: Microsoft :: Windows", - "Operating System :: MacOS :: MacOS X", - "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.2", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Topic :: Communications", - "Topic :: Software Development :: Libraries", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Terminals :: Serial" - ], - "homepage_url": "https://github.com/pyserial/pyserial", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "BSD", - "classifiers": [ - "License :: OSI Approved :: BSD License" - ] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/pyserial@3.4", - "repository_homepage_url": "https://pypi.org/project/pyserial", - "repository_download_url": "https://pypi.io/packages/source/p/pyserial/pyserial-3.4.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/pyserial/3.4/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "pyserial", + "version": "3.4", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Python Serial Port Extension", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Chris Liechti", + "email": "cliechti@gmx.net", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: End Users/Desktop", + "Natural Language :: English", + "Operating System :: POSIX", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS :: MacOS X", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Topic :: Communications", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Terminals :: Serial" + ], + "homepage_url": "https://github.com/pyserial/pyserial", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "unknown AND bsd-new", + "declared_license": { + "license": "BSD", + "classifiers": [ + "License :: OSI Approved :: BSD License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/pyserial", + "repository_download_url": "https://pypi.org/packages/source/p/pyserial/pyserial-3.4.tar.gz", + "api_data_url": "https://pypi.org/pypi/pyserial/3.4/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/pyserial@3.4" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pytoml-0.1.21/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/pytoml-0.1.21/setup.py-expected-args.json new file mode 100644 index 00000000000..95a6cbcfc30 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/pytoml-0.1.21/setup.py-expected-args.json @@ -0,0 +1,20 @@ +{ + "name": "pytoml", + "version": "0.1.21", + "description": "A parser for TOML-0.4.0", + "long_description_content_type": "text/markdown", + "author": "Martin Vejn\u00e1r", + "author_email": "vejnar.martin@gmail.com", + "url": "https://github.com/avakar/pytoml", + "license": "MIT", + "classifiers": [ + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Libraries" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/pytoml-0.1.21/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/pytoml-0.1.21/setup.py-expected.json index fc6d4b86f06..f166c791721 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/pytoml-0.1.21/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/pytoml-0.1.21/setup.py-expected.json @@ -1,54 +1,59 @@ -{ - "type": "pypi", - "namespace": null, - "name": "pytoml", - "version": "0.1.21", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "A parser for TOML-0.4.0", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Martin Vejn\u00e1r", - "email": "vejnar.martin@gmail.com", - "url": "https://github.com/avakar/pytoml" - } - ], - "keywords": [ - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Topic :: Software Development :: Libraries" - ], - "homepage_url": "https://github.com/avakar/pytoml", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "MIT", - "classifiers": [ - "License :: OSI Approved :: MIT License" - ] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/pytoml@0.1.21", - "repository_homepage_url": "https://pypi.org/project/pytoml", - "repository_download_url": "https://pypi.io/packages/source/p/pytoml/pytoml-0.1.21.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/pytoml/0.1.21/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "pytoml", + "version": "0.1.21", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "A parser for TOML-0.4.0", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Martin Vejn\u00e1r", + "email": "vejnar.martin@gmail.com", + "url": null + } + ], + "keywords": [ + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Topic :: Software Development :: Libraries" + ], + "homepage_url": "https://github.com/avakar/pytoml", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/pytoml", + "repository_download_url": "https://pypi.org/packages/source/p/pytoml/pytoml-0.1.21.tar.gz", + "api_data_url": "https://pypi.org/pypi/pytoml/0.1.21/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/pytoml@0.1.21" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/requests-2.24.0/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/requests-2.24.0/setup.py-expected-args.json new file mode 100644 index 00000000000..9afcfeea4b8 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/requests-2.24.0/setup.py-expected-args.json @@ -0,0 +1,53 @@ +{ + "long_description_content_type": "text/markdown", + "package_dir": { + "requests": "requests" + }, + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", + "install_requires": [ + "chardet>=3.0.2,<4", + "idna>=2.5,<3", + "urllib3>=1.21.1,<1.26,!=1.25.0,!=1.25.1", + "certifi>=2017.4.17" + ], + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy" + ], + "tests_require": [ + "pytest-httpbin==0.0.7", + "pytest-cov", + "pytest-mock", + "pytest-xdist", + "PySocks>=1.5.6, !=1.5.7", + "pytest>=3" + ], + "extras_require": { + "security": [ + "pyOpenSSL >= 0.14", + "cryptography>=1.3.4" + ], + "socks": [ + "PySocks>=1.5.6, !=1.5.7" + ], + "socks:sys_platform == \"win32\" and python_version == \"2.7\"": [ + "win_inet_pton" + ] + }, + "project_urls": { + "Documentation": "https://requests.readthedocs.io", + "Source": "https://github.com/psf/requests" + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/requests-2.24.0/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/requests-2.24.0/setup.py-expected.json index 9e26dfeeb6e..182846a0c04 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/requests-2.24.0/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/requests-2.24.0/setup.py-expected.json @@ -1 +1,132 @@ -{} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": null, + "version": "2.24.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "", + "release_date": null, + "parties": [], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy" + ], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": "https://github.com/psf/requests", + "vcs_url": null, + "copyright": null, + "license_expression": "apache-2.0", + "declared_license": { + "classifiers": [ + "License :: OSI Approved :: Apache Software License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "Documentation": "https://requests.readthedocs.io", + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + }, + "dependencies": [ + { + "purl": "pkg:pypi/chardet", + "extracted_requirement": "chardet<4,>=3.0.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/idna", + "extracted_requirement": "idna<3,>=2.5", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/urllib3", + "extracted_requirement": "urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/certifi", + "extracted_requirement": "certifi>=2017.4.17", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pyopenssl", + "extracted_requirement": "pyOpenSSL>=0.14", + "scope": "security", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/cryptography", + "extracted_requirement": "cryptography>=1.3.4", + "scope": "security", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pysocks", + "extracted_requirement": "PySocks!=1.5.7,>=1.5.6", + "scope": "socks", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/win-inet-pton", + "extracted_requirement": "win_inet_pton", + "scope": "socks:sys_platform == \"win32\" and python_version == \"2.7\"", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "pypi_setup_py", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/setupreader-0.0.3/setup.py b/tests/packagedcode/data/pypi/setup.py-versions/setupreader-0.0.3/setup.py new file mode 100644 index 00000000000..4288c75d4e4 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/setupreader-0.0.3/setup.py @@ -0,0 +1,75 @@ +""" +setup.py contains a function named setup. + +When writing software that works with python packages it is very +inconvenient to retrieve the package metadata from setup.py. This package +makes it easy, just point it at setup.py and get a dict. + +>>> import setupreader, json +>>> foo = setupreader.load('setup.py') +>>> print json.dumps(foo, indent=4) +{ + "description": "retrieve package specification from setup,py", + "install_requires": [ + "setuptools", + "mock" + ], + "zip_safe": false, + "keywords": "", + "packages": [], + "classifiers": [], + "entry_points": { + "console_scripts": [ + "read-setup = setupreader:main" + ] + }, + "name": "setupreader", + "license": "", + "author": "Lars van de Kerkhof", + "url": "", + "include_package_data": true, + "py_modules": [ + "setupreader" + ], + "long_description": "", + "author_email": "lars@permanentmarkers.nl", + "version": "0.0.1" +} +""" + +from setuptools import setup, find_packages + +__version__ = "0.0.3" + + +setup( + # package name in pypi + name='setupreader', + # extract version from module. + version=__version__, + description="retrieve package specification from setup.py", + long_description=__doc__, + classifiers=[], + keywords='', + author='Lars van de Kerkhof', + author_email='lars@permanentmarkers.nl', + url='https://github.com/specialunderwear/setupreader', + license='GPL', + # include all packages in the egg, except the test package. + packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), + py_modules=['setupreader'], + # include non python files + include_package_data=True, + zip_safe=False, + # specify dependencies + install_requires=[ + 'setuptools', + 'mock' + ], + # generate scripts + entry_points={ + 'console_scripts':[ + 'setupreader = setupreader:main', + ] + } +) diff --git a/tests/packagedcode/data/pypi/setup.py-versions/setupreader-0.0.3/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/setupreader-0.0.3/setup.py-expected-args.json new file mode 100644 index 00000000000..78486eedf30 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/setupreader-0.0.3/setup.py-expected-args.json @@ -0,0 +1,13 @@ +{ + "name": "setupreader", + "version": "0.0.3", + "description": "retrieve package specification from setup.py", + "author": "Lars van de Kerkhof", + "author_email": "lars@permanentmarkers.nl", + "url": "https://github.com/specialunderwear/setupreader", + "license": "GPL", + "install_requires": [ + "setuptools", + "mock" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/setupreader-0.0.3/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/setupreader-0.0.3/setup.py-expected.json new file mode 100644 index 00000000000..294c33ec445 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/setupreader-0.0.3/setup.py-expected.json @@ -0,0 +1,67 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "setupreader", + "version": "0.0.3", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "retrieve package specification from setup.py", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Lars van de Kerkhof", + "email": "lars@permanentmarkers.nl", + "url": null + } + ], + "keywords": [], + "homepage_url": "https://github.com/specialunderwear/setupreader", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "gpl-1.0-plus", + "declared_license": { + "license": "GPL" + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:pypi/setuptools", + "extracted_requirement": "setuptools", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/mock", + "extracted_requirement": "mock", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/setupreader", + "repository_download_url": "https://pypi.org/packages/source/s/setupreader/setupreader-0.0.3.tar.gz", + "api_data_url": "https://pypi.org/pypi/setupreader/0.0.3/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/setupreader@0.0.3" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/six-1.14.0/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/six-1.14.0/setup.py-expected-args.json new file mode 100644 index 00000000000..9eb40d5d772 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/six-1.14.0/setup.py-expected-args.json @@ -0,0 +1,21 @@ +{ + "name": "six", + "author": "Benjamin Peterson", + "author_email": "benjamin@python.org", + "url": "https://github.com/benjaminp/six", + "tests_require": [ + "pytest" + ], + "description": "Python 2 and 3 compatibility utilities", + "license": "MIT", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Libraries", + "Topic :: Utilities" + ], + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/six-1.14.0/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/six-1.14.0/setup.py-expected.json index 8d46d921a0a..48aeb682d2c 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/six-1.14.0/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/six-1.14.0/setup.py-expected.json @@ -1,44 +1,60 @@ -{ - "type": "pypi", - "namespace": null, - "name": "six", - "version": "1.14.0", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "Python 2 and 3 compatibility utilities", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Benjamin Peterson", - "email": "benjamin@python.org", - "url": "https://github.com/benjaminp/six" - } - ], - "keywords": [], - "homepage_url": "https://github.com/benjaminp/six", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "MIT", - "classifiers": [] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/six@1.14.0", - "repository_homepage_url": "https://pypi.org/project/six", - "repository_download_url": "https://pypi.io/packages/source/s/six/six-1.14.0.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/six/1.14.0/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "six", + "version": "1.14.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Python 2 and 3 compatibility utilities", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Benjamin Peterson", + "email": "benjamin@python.org", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries", + "Topic :: Utilities" + ], + "homepage_url": "https://github.com/benjaminp/six", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + }, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/six", + "repository_download_url": "https://pypi.org/packages/source/s/six/six-1.14.0.tar.gz", + "api_data_url": "https://pypi.org/pypi/six/1.14.0/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/six@1.14.0" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/urllib3-1.25.9/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/urllib3-1.25.9/setup.py-expected-args.json new file mode 100644 index 00000000000..d7af9a6639f --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/urllib3-1.25.9/setup.py-expected-args.json @@ -0,0 +1,61 @@ +{ + "name": "urllib3", + "description": "HTTP library with thread-safe connection pooling, file post, and more.", + "classifiers": [ + "Environment :: Web Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Software Development :: Libraries" + ], + "keywords": [ + "urllib", + "httplib", + "threadsafe", + "filepost", + "http", + "https", + "ssl", + "pooling" + ], + "author": "Andrey Petrov", + "author_email": "andrey.petrov@shazow.net", + "url": "https://urllib3.readthedocs.io/", + "project_urls": { + "Documentation": "https://urllib3.readthedocs.io/", + "Code": "https://github.com/urllib3/urllib3", + "Issue tracker": "https://github.com/urllib3/urllib3/issues" + }, + "license": "MIT", + "package_dir": { + "": "src" + }, + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4", + "extras_require": { + "brotli": [ + "brotlipy>=0.6.0" + ], + "secure": [ + "pyOpenSSL>=0.14", + "cryptography>=1.3.4", + "idna>=2.0.0", + "certifi", + "ipaddress; python_version=='2.7'" + ], + "socks": [ + "PySocks>=1.5.6,<2.0,!=1.5.7" + ] + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/urllib3-1.25.9/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/urllib3-1.25.9/setup.py-expected.json index 03e317cfd31..cfe64d80c30 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/urllib3-1.25.9/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/urllib3-1.25.9/setup.py-expected.json @@ -1,63 +1,143 @@ -{ - "type": "pypi", - "namespace": null, - "name": "urllib3", - "version": "1.25.9", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "HTTP library with thread-safe connection pooling, file post, and more.", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Andrey Petrov", - "email": "andrey.petrov@shazow.net", - "url": "https://urllib3.readthedocs.io/" - } - ], - "keywords": [ - "Environment :: Web Environment", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Software Development :: Libraries" - ], - "homepage_url": "https://urllib3.readthedocs.io/", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "MIT", - "classifiers": [ - "License :: OSI Approved :: MIT License" - ] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/urllib3@1.25.9", - "repository_homepage_url": "https://pypi.org/project/urllib3", - "repository_download_url": "https://pypi.io/packages/source/u/urllib3/urllib3-1.25.9.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/urllib3/1.25.9/json" -} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": "urllib3", + "version": "1.25.9", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "HTTP library with thread-safe connection pooling, file post, and more.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Andrey Petrov", + "email": "andrey.petrov@shazow.net", + "url": null + } + ], + "keywords": [ + "urllib", + "httplib", + "threadsafe", + "filepost", + "http", + "https", + "ssl", + "pooling", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Software Development :: Libraries" + ], + "homepage_url": "https://urllib3.readthedocs.io/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": "https://github.com/urllib3/urllib3/issues", + "code_view_url": "https://github.com/urllib3/urllib3", + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "Documentation": "https://urllib3.readthedocs.io/", + "python_requires": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" + }, + "dependencies": [ + { + "purl": "pkg:pypi/brotlipy", + "extracted_requirement": "brotlipy>=0.6.0", + "scope": "brotli", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pyopenssl", + "extracted_requirement": "pyOpenSSL>=0.14", + "scope": "secure", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/cryptography", + "extracted_requirement": "cryptography>=1.3.4", + "scope": "secure", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/idna", + "extracted_requirement": "idna>=2.0.0", + "scope": "secure", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/certifi", + "extracted_requirement": "certifi", + "scope": "secure", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/ipaddress", + "extracted_requirement": "ipaddress; python_version == \"2.7\"", + "scope": "secure", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pysocks", + "extracted_requirement": "PySocks!=1.5.7,<2.0,>=1.5.6", + "scope": "socks", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/urllib3", + "repository_download_url": "https://pypi.org/packages/source/u/urllib3/urllib3-1.25.9.tar.gz", + "api_data_url": "https://pypi.org/pypi/urllib3/1.25.9/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/urllib3@1.25.9" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/wheel-0.34.2/setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py-versions/wheel-0.34.2/setup.py-expected-args.json new file mode 100644 index 00000000000..c52b020e8f8 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py-versions/wheel-0.34.2/setup.py-expected-args.json @@ -0,0 +1,3 @@ +{ + "maintainer": "Alex Gr\u00f6nholm" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py-versions/wheel-0.34.2/setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py-versions/wheel-0.34.2/setup.py-expected.json index 9e26dfeeb6e..aaf05585743 100644 --- a/tests/packagedcode/data/pypi/setup.py-versions/wheel-0.34.2/setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py-versions/wheel-0.34.2/setup.py-expected.json @@ -1 +1,46 @@ -{} \ No newline at end of file +[ + { + "type": "pypi", + "namespace": null, + "name": null, + "version": "0.34.2", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "maintainer", + "name": "Alex Gr\u00f6nholm", + "email": null, + "url": null + } + ], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": {}, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "pypi_setup_py", + "purl": null + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/bluepyopt_setup.py b/tests/packagedcode/data/pypi/setup.py/bluepyopt_setup.py new file mode 100644 index 00000000000..887bd3bfe3b --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/bluepyopt_setup.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +"""BluePyOpt setup """ + +""" +Copyright (c) 2016-2020, EPFL/Blue Brain Project + + This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> + + This library is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License version 3.0 as published + by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +""" + +import setuptools +import versioneer + + +EXTRA_SCOOP = [ + 'scoop>=0.7', +] + +setuptools.setup( + name="bluepyopt", + version=versioneer.get_version(), + cmdclass=versioneer.get_cmdclass(), + install_requires=[ + 'numpy>=1.6', + 'pandas>=0.18', + 'deap', + 'efel>=2.13', + 'ipyparallel', + 'pickleshare>=0.7.3', + 'Jinja2>=2.8', + 'future', + 'Pebble>=4.3.10' + ], + extras_require={ + 'all': EXTRA_SCOOP, + 'scoop': EXTRA_SCOOP, + }, + packages=setuptools.find_packages( + exclude=( + 'examples', + )), + author="BlueBrain Project, EPFL", + author_email="werner.vangeit@epfl.ch", + description="Bluebrain Python Optimisation Library (bluepyopt)", + long_description="The Blue Brain Python Optimisation Library (BluePyOpt) " + "is an extensible framework for data-driven model parameter " + "optimisation that wraps and standardises several existing " + "open-source tools. It simplifies the task of creating and " + "sharing these optimisations, and the associated techniques " + "and knowledge. This is achieved by abstracting the optimisation " + "and evaluation tasks into various reusable and flexible discrete " + "elements according to established best-practices.", + license="LGPLv3", + keywords=( + 'optimisation', + 'neuroscience', + 'BlueBrainProject'), + url='https://github.com/BlueBrain/BluePyOpt', + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'License :: OSI Approved :: GNU Lesser General Public ' + 'License v3 (LGPLv3)', + 'Programming Language :: Python :: 3 :: Only', + 'Operating System :: POSIX', + 'Topic :: Scientific/Engineering', + 'Topic :: Utilities'], + entry_points={ + 'console_scripts': ['bpopt_tasksdb=bluepyopt.ipyp.bpopt_tasksdb:main'], + }, + package_data={ + 'bluepyopt': [ + 'ephys/templates/cell_template.jinja2', + 'ephys/examples/simplecell/simple.swc'], + }) diff --git a/tests/packagedcode/data/pypi/setup.py/bluepyopt_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/bluepyopt_setup.py-expected-args.json new file mode 100644 index 00000000000..e3b771c008e --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/bluepyopt_setup.py-expected-args.json @@ -0,0 +1,42 @@ +{ + "name": "bluepyopt", + "install_requires": [ + "numpy>=1.6", + "pandas>=0.18", + "deap", + "efel>=2.13", + "ipyparallel", + "pickleshare>=0.7.3", + "Jinja2>=2.8", + "future", + "Pebble>=4.3.10" + ], + "extras_require": { + "all": [ + "scoop>=0.7" + ], + "scoop": [ + "scoop>=0.7" + ] + }, + "author": "BlueBrain Project, EPFL", + "author_email": "werner.vangeit@epfl.ch", + "description": "Bluebrain Python Optimisation Library (bluepyopt)", + "long_description": "The Blue Brain Python Optimisation Library (BluePyOpt) is an extensible framework for data-driven model parameter optimisation that wraps and standardises several existing open-source tools. It simplifies the task of creating and sharing these optimisations, and the associated techniques and knowledge. This is achieved by abstracting the optimisation and evaluation tasks into various reusable and flexible discrete elements according to established best-practices.", + "license": "LGPLv3", + "keywords": [ + "optimisation", + "neuroscience", + "BlueBrainProject" + ], + "url": "https://github.com/BlueBrain/BluePyOpt", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", + "Programming Language :: Python :: 3 :: Only", + "Operating System :: POSIX", + "Topic :: Scientific/Engineering", + "Topic :: Utilities" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/bluepyopt_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/bluepyopt_setup.py-expected.json new file mode 100644 index 00000000000..f313a7ce394 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/bluepyopt_setup.py-expected.json @@ -0,0 +1,161 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "bluepyopt", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Bluebrain Python Optimisation Library (bluepyopt)", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "BlueBrain Project, EPFL", + "email": "werner.vangeit@epfl.ch", + "url": null + } + ], + "keywords": [ + "optimisation", + "neuroscience", + "BlueBrainProject", + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Programming Language :: Python :: 3 :: Only", + "Operating System :: POSIX", + "Topic :: Scientific/Engineering", + "Topic :: Utilities" + ], + "homepage_url": "https://github.com/BlueBrain/BluePyOpt", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "lgpl-3.0", + "declared_license": { + "license": "LGPLv3", + "classifiers": [ + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:pypi/numpy", + "extracted_requirement": "numpy>=1.6", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pandas", + "extracted_requirement": "pandas>=0.18", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/deap", + "extracted_requirement": "deap", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/efel", + "extracted_requirement": "efel>=2.13", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/ipyparallel", + "extracted_requirement": "ipyparallel", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pickleshare", + "extracted_requirement": "pickleshare>=0.7.3", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/jinja2", + "extracted_requirement": "Jinja2>=2.8", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/future", + "extracted_requirement": "future", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pebble", + "extracted_requirement": "Pebble>=4.3.10", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/scoop", + "extracted_requirement": "scoop>=0.7", + "scope": "all", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/scoop", + "extracted_requirement": "scoop>=0.7", + "scope": "scoop", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/bluepyopt", + "repository_download_url": null, + "api_data_url": "https://pypi.org/pypi/bluepyopt/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/bluepyopt" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/boolean2_py_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/boolean2_py_setup.py-expected-args.json new file mode 100644 index 00000000000..a897686d160 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/boolean2_py_setup.py-expected-args.json @@ -0,0 +1,29 @@ +{ + "name": "boolean.py", + "version": "1.2", + "license": "revised BSD license", + "description": "Boolean Algreba", + "long_description": "\nThis library helps you deal with boolean expressions and algebra with variables\nand the boolean functions AND, OR, NOT.\n\nYou can parse expressions from strings and simplify and compare expressions.\nYou can also easily create custom tokenizers to handle custom expressions. \n\nFor extensive documentation look either into the docs directory or view it online, at\nhttps://booleanpy.readthedocs.org/en/latest/\n\nhttps://github.com/bastikr/boolean.py\n\nCopyright (c) 2009-2016 Sebastian Kraemer, basti.kr@gmail.com and others\n\nReleased under revised BSD license.\n", + "author": "Sebastian Kraemer", + "author_email": "basti.kr@gmail.com", + "url": "https://github.com/bastikr/boolean.py", + "keywords": [ + "boolean expression", + "boolean algebra", + "logic", + "expression parser" + ], + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering :: Mathematics", + "Topic :: Software Development :: Compilers", + "Topic :: Software Development :: Libraries", + "Topic :: Utilities" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/boolean2_py_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/boolean2_py_setup.py-expected.json index 75b5b98046e..91766165f27 100644 --- a/tests/packagedcode/data/pypi/setup.py/boolean2_py_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/boolean2_py_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Sebastian Kraemer", - "email": null, + "email": "basti.kr@gmail.com", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/container_check_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/container_check_setup.py-expected-args.json new file mode 100644 index 00000000000..b5825284bf7 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/container_check_setup.py-expected-args.json @@ -0,0 +1,27 @@ +{ + "name": "container-check", + "version": "1.0.6", + "description": "Tool for checking and updating rpm based containers.", + "url": "https://github.com/imain/container-check", + "author": "Ian Main", + "author_email": "imain@redhat.com", + "license": "Apache Software License", + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Topic :: System :: Archiving :: Packaging", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5" + ], + "keywords": [ + "containers", + "update", + "rpm", + "yum" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/container_check_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/container_check_setup.py-expected.json index 4fa4b75d844..753ba7d4099 100644 --- a/tests/packagedcode/data/pypi/setup.py/container_check_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/container_check_setup.py-expected.json @@ -14,12 +14,15 @@ "type": "person", "role": "author", "name": "Ian Main", - "email": null, + "email": "imain@redhat.com", "url": null } ], "keywords": [ - "containers update rpm yum", + "containers", + "update", + "rpm", + "yum", "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Topic :: System :: Archiving :: Packaging", diff --git a/tests/packagedcode/data/pypi/setup.py/fb303_py_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/fb303_py_setup.py-expected-args.json new file mode 100644 index 00000000000..a83fd56ea64 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/fb303_py_setup.py-expected-args.json @@ -0,0 +1,22 @@ +{ + "name": "thrift_fb303", + "version": "0.10.0", + "description": "Python bindings for the Apache Thrift FB303", + "author": [ + "Thrift Developers" + ], + "author_email": [ + "dev@thrift.apache.org" + ], + "url": "http://thrift.apache.org", + "license": "Apache License 2.0", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Topic :: Software Development :: Libraries", + "Topic :: System :: Networking" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/fb303_py_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/fb303_py_setup.py-expected.json index 5f134f833b7..2942177d747 100644 --- a/tests/packagedcode/data/pypi/setup.py/fb303_py_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/fb303_py_setup.py-expected.json @@ -16,7 +16,9 @@ "name": [ "Thrift Developers" ], - "email": null, + "email": [ + "dev@thrift.apache.org" + ], "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/frell_src_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/frell_src_setup.py-expected-args.json new file mode 100644 index 00000000000..a5fc0673c43 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/frell_src_setup.py-expected-args.json @@ -0,0 +1,11 @@ +{ + "name": "@NAME@", + "description": "Python module @MODULE@", + "author": "Brett Smith", + "author_email": "bc.smith@sas.com", + "license": "Apache License 2.0", + "tests_require": [ + "pytest", + "mock" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/frell_src_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/frell_src_setup.py-expected.json index f25ef2211db..31bf9762515 100644 --- a/tests/packagedcode/data/pypi/setup.py/frell_src_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/frell_src_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Brett Smith", - "email": null, + "email": "bc.smith@sas.com", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/gyp_setup.py b/tests/packagedcode/data/pypi/setup.py/gyp_setup.py old mode 100755 new mode 100644 diff --git a/tests/packagedcode/data/pypi/setup.py/gyp_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/gyp_setup.py-expected-args.json new file mode 100644 index 00000000000..cc69b26c115 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/gyp_setup.py-expected-args.json @@ -0,0 +1,11 @@ +{ + "name": "gyp", + "version": "0.1", + "description": "Generate Your Projects", + "author": "Chromium Authors", + "author_email": "chromium-dev@googlegroups.com", + "url": "http://code.google.com/p/gyp", + "package_dir": { + "": "pylib" + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/gyp_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/gyp_setup.py-expected.json index e98a9babcd3..f4138305ae6 100644 --- a/tests/packagedcode/data/pypi/setup.py/gyp_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/gyp_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Chromium Authors", - "email": null, + "email": "chromium-dev@googlegroups.com", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/interlap_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/interlap_setup.py-expected-args.json new file mode 100644 index 00000000000..c5361a88f97 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/interlap_setup.py-expected-args.json @@ -0,0 +1,21 @@ +{ + "name": "interlap", + "author": "Brent S Pedersen", + "author_email": "bpederse@gmail.com", + "url": "http://brentp.github.io/interlap", + "description": "interlap: fast, simple interval overlap testing", + "license": "MIT", + "classifiers": [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Intended Audience :: Science/Research", + "Natural Language :: English", + "Operating System :: Unix", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Scientific/Engineering :: Bio-Informatics" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/interlap_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/interlap_setup.py-expected.json index 9fec073f235..ea042626b8c 100644 --- a/tests/packagedcode/data/pypi/setup.py/interlap_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/interlap_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Brent S Pedersen", - "email": null, + "email": "bpederse@gmail.com", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/mb_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/mb_setup.py-expected-args.json new file mode 100644 index 00000000000..e7b1cbd9146 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/mb_setup.py-expected-args.json @@ -0,0 +1,9 @@ +{ + "name": "mb", + "version": "2.19.0", + "description": "mb, a tool to maintain the MirrorBrain database", + "author": "MirrorBrain project", + "author_email": "info@mirrorbrain.org", + "license": "GPLv2", + "url": "http://mirrorbrain.org/" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/mb_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/mb_setup.py-expected.json index b9dc63d7788..06a84de7323 100644 --- a/tests/packagedcode/data/pypi/setup.py/mb_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/mb_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "MirrorBrain project", - "email": null, + "email": "info@mirrorbrain.org", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/ntfs_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/ntfs_setup.py-expected-args.json new file mode 100644 index 00000000000..dc5aeade7fd --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/ntfs_setup.py-expected-args.json @@ -0,0 +1,27 @@ +{ + "name": "ntfsutils", + "version": "0.1.1", + "description": "A Python module to manipulate NTFS hard links and junctions.", + "classifiers": [ + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: 2.5", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.2" + ], + "keywords": [ + "windows", + "ntfs", + "hardlink", + "junction" + ], + "author": "Siddharth Agarwal", + "author_email": "sid.bugzilla@gmail.com", + "url": "https://github.com/sid0/ntfs", + "license": "BSD", + "install_requires": [ + "setuptools" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/ntfs_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/ntfs_setup.py-expected.json index 0359f58f47f..6b5206f2fb2 100644 --- a/tests/packagedcode/data/pypi/setup.py/ntfs_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/ntfs_setup.py-expected.json @@ -3,7 +3,7 @@ "type": "pypi", "namespace": null, "name": "ntfsutils", - "version": null, + "version": "0.1.1", "qualifiers": {}, "subpath": null, "primary_language": "Python", @@ -14,12 +14,15 @@ "type": "person", "role": "author", "name": "Siddharth Agarwal", - "email": null, + "email": "sid.bugzilla@gmail.com", "url": null } ], "keywords": [ - "windows ntfs hardlink junction", + "windows", + "ntfs", + "hardlink", + "junction", "Intended Audience :: Developers", "Topic :: Software Development :: Libraries :: Python Modules", "Programming Language :: Python :: 2.5", @@ -49,11 +52,21 @@ "source_packages": [], "file_references": [], "extra_data": {}, - "dependencies": [], + "dependencies": [ + { + "purl": "pkg:pypi/setuptools", + "extracted_requirement": "setuptools", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], "repository_homepage_url": "https://pypi.org/project/ntfsutils", - "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/ntfsutils/json", + "repository_download_url": "https://pypi.org/packages/source/n/ntfsutils/ntfsutils-0.1.1.tar.gz", + "api_data_url": "https://pypi.org/pypi/ntfsutils/0.1.1/json", "datasource_id": "pypi_setup_py", - "purl": "pkg:pypi/ntfsutils" + "purl": "pkg:pypi/ntfsutils@0.1.1" } ] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/nvchecker_setup.py b/tests/packagedcode/data/pypi/setup.py/nvchecker_setup.py old mode 100755 new mode 100644 diff --git a/tests/packagedcode/data/pypi/setup.py/nvchecker_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/nvchecker_setup.py-expected-args.json new file mode 100644 index 00000000000..9835eaf647a --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/nvchecker_setup.py-expected-args.json @@ -0,0 +1,42 @@ +{ + "name": "nvchecker", + "author": "lilydjwg", + "author_email": "lilydjwg@gmail.com", + "description": "New version checker for software", + "license": "MIT", + "keywords": [ + "new", + "version", + "build", + "check" + ], + "url": "https://github.com/lilydjwg/nvchecker", + "platforms": "any", + "install_requires": [ + "tornado>=4.1", + "setuptools" + ], + "tests_require": [ + "pytest", + "flaky" + ], + "classifiers": [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Topic :: Internet", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Software Development", + "Topic :: System :: Archiving :: Packaging", + "Topic :: System :: Software Distribution", + "Topic :: Utilities" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/nvchecker_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/nvchecker_setup.py-expected.json index 3c345b748e0..7e9ced35a79 100644 --- a/tests/packagedcode/data/pypi/setup.py/nvchecker_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/nvchecker_setup.py-expected.json @@ -14,12 +14,15 @@ "type": "person", "role": "author", "name": "lilydjwg", - "email": null, + "email": "lilydjwg@gmail.com", "url": null } ], "keywords": [ - "new version build check", + "new", + "version", + "build", + "check", "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", diff --git a/tests/packagedcode/data/pypi/setup.py/oi_agents_common_code_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/oi_agents_common_code_setup.py-expected-args.json new file mode 100644 index 00000000000..9bccd940045 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/oi_agents_common_code_setup.py-expected-args.json @@ -0,0 +1,32 @@ +{ + "name": "agents_common", + "description": "Function utils for OII agents", + "url": "https://lab.openintegrity.org/agents/agents-common-code", + "author": "__author__", + "author_email": "juga@riseup.net", + "license": "GPLv3", + "classifiers": [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: GPLv3 License", + "Natural Language :: English", + "Programming Language :: Python :: 2.7", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Utilities" + ], + "keywords": [ + "agents", + "development", + "utils" + ], + "extras_require": { + "dev": [ + "ipython" + ], + "test": [ + "coverage" + ] + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/oi_agents_common_code_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/oi_agents_common_code_setup.py-expected.json index aed0e04678b..71021387bb0 100644 --- a/tests/packagedcode/data/pypi/setup.py/oi_agents_common_code_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/oi_agents_common_code_setup.py-expected.json @@ -14,12 +14,14 @@ "type": "person", "role": "author", "name": "__author__", - "email": null, + "email": "juga@riseup.net", "url": null } ], "keywords": [ - "agents development utils", + "agents", + "development", + "utils", "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", @@ -51,7 +53,26 @@ "source_packages": [], "file_references": [], "extra_data": {}, - "dependencies": [], + "dependencies": [ + { + "purl": "pkg:pypi/ipython", + "extracted_requirement": "ipython", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/coverage", + "extracted_requirement": "coverage", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], "repository_homepage_url": "https://pypi.org/project/agents_common", "repository_download_url": null, "api_data_url": "https://pypi.org/pypi/agents_common/json", diff --git a/tests/packagedcode/data/pypi/setup.py/packageurl_python_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/packageurl_python_setup.py-expected-args.json new file mode 100644 index 00000000000..58e9332179a --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/packageurl_python_setup.py-expected-args.json @@ -0,0 +1,32 @@ +{ + "name": "packageurl-python", + "version": "0.8.5", + "license": "MIT", + "description": "A \"purl\" aka. package URL parser and builder", + "long_description": "Python library to parse and build \"purl\" aka. package URLs. This is a microlibrary implementing the purl spec at https://github.com/package-url", + "author": "the purl authors", + "url": "https://github.com/package-url/packageurl-python", + "package_dir": { + "": "src" + }, + "platforms": "any", + "keywords": [ + "package", + "url", + "package manager", + "package url" + ], + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Topic :: Software Development :: Libraries", + "Topic :: Utilities" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/pipdeptree_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/pipdeptree_setup.py-expected-args.json new file mode 100644 index 00000000000..d50aa74183a --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/pipdeptree_setup.py-expected-args.json @@ -0,0 +1,29 @@ +{ + "name": "pipdeptree", + "author": "Vineet Naik", + "author_email": "naikvin@gmail.com", + "url": "https://github.com/naiquevin/pipdeptree", + "license": "MIT License", + "description": "Command line utility to show dependency tree of packages", + "install_requires": [ + "pip >= 6.0.0" + ], + "extras_require": { + "graphviz": [ + "graphviz" + ] + }, + "python_requires": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*", + "classifiers": [ + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/pipdeptree_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/pipdeptree_setup.py-expected.json index 92f512c5b55..93a22ba16ac 100644 --- a/tests/packagedcode/data/pypi/setup.py/pipdeptree_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/pipdeptree_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Vineet Naik", - "email": null, + "email": "naikvin@gmail.com", "url": null } ], @@ -50,8 +50,29 @@ "notice_text": null, "source_packages": [], "file_references": [], - "extra_data": {}, - "dependencies": [], + "extra_data": { + "python_requires": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*" + }, + "dependencies": [ + { + "purl": "pkg:pypi/pip", + "extracted_requirement": "pip>=6.0.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/graphviz", + "extracted_requirement": "graphviz", + "scope": "graphviz", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], "repository_homepage_url": "https://pypi.org/project/pipdeptree", "repository_download_url": null, "api_data_url": "https://pypi.org/pypi/pipdeptree/json", diff --git a/tests/packagedcode/data/pypi/setup.py/pluggy_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/pluggy_setup.py-expected-args.json new file mode 100644 index 00000000000..48b068f6ad7 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/pluggy_setup.py-expected-args.json @@ -0,0 +1,14 @@ +{ + "name": "pluggy", + "description": "plugin and hook calling mechanisms for python", + "license": "MIT license", + "platforms": [ + "unix", + "linux", + "osx", + "win32" + ], + "author": "Holger Krekel", + "author_email": "holger at merlinux.eu", + "url": "https://github.com/pytest-dev/pluggy" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/pluggy_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/pluggy_setup.py-expected.json index 20219bff27e..b3e6a439d57 100644 --- a/tests/packagedcode/data/pypi/setup.py/pluggy_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/pluggy_setup.py-expected.json @@ -2,16 +2,24 @@ { "type": "pypi", "namespace": null, - "name": null, + "name": "pluggy", "version": null, "qualifiers": {}, "subpath": null, "primary_language": "Python", - "description": "", + "description": "plugin and hook calling mechanisms for python", "release_date": null, - "parties": [], + "parties": [ + { + "type": "person", + "role": "author", + "name": "Holger Krekel", + "email": "holger at merlinux.eu", + "url": null + } + ], "keywords": [], - "homepage_url": null, + "homepage_url": "https://github.com/pytest-dev/pluggy", "download_url": null, "size": null, "sha1": null, @@ -22,17 +30,19 @@ "code_view_url": null, "vcs_url": null, "copyright": null, - "license_expression": null, - "declared_license": {}, + "license_expression": "mit", + "declared_license": { + "license": "MIT license" + }, "notice_text": null, "source_packages": [], "file_references": [], "extra_data": {}, "dependencies": [], - "repository_homepage_url": null, + "repository_homepage_url": "https://pypi.org/project/pluggy", "repository_download_url": null, - "api_data_url": null, + "api_data_url": "https://pypi.org/pypi/pluggy/json", "datasource_id": "pypi_setup_py", - "purl": null + "purl": "pkg:pypi/pluggy" } ] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/pydep_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/pydep_setup.py-expected-args.json new file mode 100644 index 00000000000..cb4840f4034 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/pydep_setup.py-expected-args.json @@ -0,0 +1,10 @@ +{ + "name": "pydep", + "version": "0.0", + "url": "http://github.com/sourcegraph/pydep", + "author": "Beyang Liu", + "description": "A simple module that will print the dependencies of a python projectUsage: python -m pydep <dir>", + "install_requires": [ + "pip==7.1.2" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/pygtrie_setup.py b/tests/packagedcode/data/pypi/setup.py/pygtrie_with_kwargs_setup.py similarity index 100% rename from tests/packagedcode/data/pypi/setup.py/pygtrie_setup.py rename to tests/packagedcode/data/pypi/setup.py/pygtrie_with_kwargs_setup.py diff --git a/tests/packagedcode/data/pypi/setup.py/pygtrie_with_kwargs_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/pygtrie_with_kwargs_setup.py-expected-args.json new file mode 100644 index 00000000000..968f0beddee --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/pygtrie_with_kwargs_setup.py-expected-args.json @@ -0,0 +1,25 @@ +{ + "name": "pygtrie", + "description": "Trie data structure implementation.", + "author": "Michal Nazarewicz", + "author_email": "mina86@mina86.com", + "url": "https://github.com/google/pygtrie", + "license": "Apache-2.0", + "platforms": "Platform Independent", + "keywords": [ + "trie", + "prefix tree", + "data structure" + ], + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Topic :: Software Development :: Libraries :: Python Modules" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/pygtrie_with_kwargs_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/pygtrie_with_kwargs_setup.py-expected.json new file mode 100644 index 00000000000..33ffb8de343 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/pygtrie_with_kwargs_setup.py-expected.json @@ -0,0 +1,63 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "pygtrie", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Trie data structure implementation.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Michal Nazarewicz", + "email": "mina86@mina86.com", + "url": null + } + ], + "keywords": [ + "trie", + "prefix tree", + "data structure", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Topic :: Software Development :: Libraries :: Python Modules" + ], + "homepage_url": "https://github.com/google/pygtrie", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "apache-2.0", + "declared_license": { + "license": "Apache-2.0", + "classifiers": [ + "License :: OSI Approved :: Apache Software License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/pygtrie", + "repository_download_url": null, + "api_data_url": "https://pypi.org/pypi/pygtrie/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/pygtrie" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/pyrpm_2_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/pyrpm_2_setup.py-expected-args.json new file mode 100644 index 00000000000..2cdd82b77a1 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/pyrpm_2_setup.py-expected-args.json @@ -0,0 +1,23 @@ +{ + "name": "pyrpm-02strich", + "version": "0.5.3", + "description": "A pure python rpm reader and YUM metadata generator", + "author": "Stefan Richter", + "author_email": "stefan@02strich.de", + "url": "https://github.com/02strich/pyrpm", + "license": "BSD", + "classifiers": [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.4", + "Programming Language :: Python :: 2.5", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.1", + "Topic :: Software Development :: Libraries" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/pyrpm_2_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/pyrpm_2_setup.py-expected.json index 375ed5a1082..0633e92e2ee 100644 --- a/tests/packagedcode/data/pypi/setup.py/pyrpm_2_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/pyrpm_2_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Stefan Richter", - "email": null, + "email": "stefan@02strich.de", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/python_publicsuffix_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/python_publicsuffix_setup.py-expected-args.json new file mode 100644 index 00000000000..9c670608b25 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/python_publicsuffix_setup.py-expected-args.json @@ -0,0 +1,15 @@ +{ + "name": "publicsuffix", + "version": "1.1.1", + "description": "Get a public suffix for a domain name using the Public Suffix List.", + "license": "MIT", + "author": "Tomaz Solc", + "author_email": "tomaz.solc@tablix.org", + "classifiers": [ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", + "Topic :: Internet :: Name Service (DNS)" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/python_publicsuffix_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/python_publicsuffix_setup.py-expected.json index 3244826ac11..5893e9a543e 100644 --- a/tests/packagedcode/data/pypi/setup.py/python_publicsuffix_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/python_publicsuffix_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Tomaz Solc", - "email": null, + "email": "tomaz.solc@tablix.org", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/repology_py_libversion_setup.py b/tests/packagedcode/data/pypi/setup.py/repology_py_libversion_setup.py old mode 100755 new mode 100644 diff --git a/tests/packagedcode/data/pypi/setup.py/repology_py_libversion_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/repology_py_libversion_setup.py-expected-args.json new file mode 100644 index 00000000000..d22c68ac153 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/repology_py_libversion_setup.py-expected-args.json @@ -0,0 +1,20 @@ +{ + "name": "libversion", + "description": "Python bindings for libversion", + "author": "Dmitry Marakasov", + "author_email": "amdmi3@amdmi3.ru", + "url": "https://github.com/repology/py-libversion", + "license": "MIT", + "classifiers": [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Environment :: Web Environment", + "License :: OSI Approved :: MIT License", + "Programming Language :: C", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.6", + "Topic :: Software Development :: Version Control", + "Topic :: System :: Archiving :: Packaging", + "Topic :: System :: Software Distribution" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/repology_py_libversion_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/repology_py_libversion_setup.py-expected.json index 021a3c86fdc..87e7ebda058 100644 --- a/tests/packagedcode/data/pypi/setup.py/repology_py_libversion_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/repology_py_libversion_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Dmitry Marakasov", - "email": null, + "email": "amdmi3@amdmi3.ru", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/saneyaml_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/saneyaml_setup.py-expected-args.json new file mode 100644 index 00000000000..06e805aa0f7 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/saneyaml_setup.py-expected-args.json @@ -0,0 +1,35 @@ +{ + "name": "saneyaml", + "version": "0.2dev", + "license": "Apache-2.0", + "description": "Dump readable YAML and load safely any YAML preserving ordering and avoiding surprises of type conversions. This library is a PyYaml wrapper with sane behaviour to read and write readable YAML safely, typically when used for configuration.", + "author": "AboutCode authors and others.", + "author_email": "info@nexb.com", + "url": "http://aboutcode.org", + "package_dir": { + "": "src" + }, + "platforms": "any", + "classifiers": [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Topic :: Software Development", + "Topic :: Utilities" + ], + "keywords": [ + "yaml", + "block", + "flow", + "readable" + ], + "install_requires": [ + "PyYAML >= 3.11, <= 3.13" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/saneyaml_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/saneyaml_setup.py-expected.json index 9cbf2a4855a..bd533ceeabf 100644 --- a/tests/packagedcode/data/pypi/setup.py/saneyaml_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/saneyaml_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "AboutCode authors and others.", - "email": null, + "email": "info@nexb.com", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/setup.py-simple-expected.json b/tests/packagedcode/data/pypi/setup.py/setup.py-simple-expected.json deleted file mode 100644 index 7a65bc7b941..00000000000 --- a/tests/packagedcode/data/pypi/setup.py/setup.py-simple-expected.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "type": "pypi", - "namespace": null, - "name": "scancode-toolkit", - "version": "1.5.0", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "ScanCode is a tool to scan code for license, copyright and other interesting facts.", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "ScanCode", - "email": "info@scancode.io", - "url": "https://github.com/nexB/scancode-toolkit" - } - ], - "keywords": [ - "license", - "filetype", - "urn", - "date", - "codec", - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Programming Language :: Python", - "Programming Language :: Python :: 2.7", - "Topic :: Utilities" - ], - "homepage_url": "https://github.com/nexB/scancode-toolkit", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": "(((apache-2.0 AND scancode-acknowledgment) AND cc0-1.0) AND unknown) AND apache-2.0 AND (free-unknown AND unknown)", - "declared_license": { - "license": "Apache-2.0 with ScanCode acknowledgment and CC0-1.0 and others", - "classifiers": [ - "License :: OSI Approved :: Apache Software License", - "License :: OSI Approved :: CC0" - ] - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "purl": "pkg:pypi/scancode-toolkit@1.5.0", - "repository_homepage_url": "https://pypi.org/project/scancode-toolkit", - "repository_download_url": "https://pypi.io/packages/source/s/scancode-toolkit/scancode-toolkit-1.5.0.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/scancode-toolkit/1.5.0/json" -} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/setuppycheck_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/setuppycheck_setup.py-expected-args.json new file mode 100644 index 00000000000..7b14b13ffc0 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/setuppycheck_setup.py-expected-args.json @@ -0,0 +1,16 @@ +{ + "name": "setuppycheck", + "description": "Checks for questionable practices in setup.py files.", + "keywords": [ + "setup.py", + "pin", + "dependencies" + ], + "author": "Marc Abramowitz", + "author_email": "msabramo@gmail.com", + "install_requires": [ + "mock" + ], + "url": "https://github.com/msabramo/setuppycheck", + "license": "MIT" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/setuppycheck_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/setuppycheck_setup.py-expected.json index c8650893662..85cffd1793c 100644 --- a/tests/packagedcode/data/pypi/setup.py/setuppycheck_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/setuppycheck_setup.py-expected.json @@ -14,12 +14,14 @@ "type": "person", "role": "author", "name": "Marc Abramowitz", - "email": null, + "email": "msabramo@gmail.com", "url": null } ], "keywords": [ - "setup.py pin dependencies" + "setup.py", + "pin", + "dependencies" ], "homepage_url": "https://github.com/msabramo/setuppycheck", "download_url": null, diff --git a/tests/packagedcode/data/pypi/setup.py/simple-setup.py b/tests/packagedcode/data/pypi/setup.py/simple-setup.py index fe0b8c8f23c..0b610c729ef 100644 --- a/tests/packagedcode/data/pypi/setup.py/simple-setup.py +++ b/tests/packagedcode/data/pypi/setup.py/simple-setup.py @@ -113,6 +113,7 @@ def read(*names, **kwargs): 'pytest-xdist', 'bumpversion', ], + 'doc': 'sphinx', }, entry_points={ diff --git a/tests/packagedcode/data/pypi/setup.py/simple-setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/simple-setup.py-expected-args.json new file mode 100644 index 00000000000..c3a56bad96f --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/simple-setup.py-expected-args.json @@ -0,0 +1,68 @@ +{ + "name": "scancode-toolkit", + "version": "1.5.0", + "license": "Apache-2.0 with ScanCode acknowledgment and CC0-1.0 and others", + "description": "ScanCode is a tool to scan code for license, copyright and other interesting facts.", + "author": "ScanCode", + "author_email": "info@scancode.io", + "url": "https://github.com/nexB/scancode-toolkit", + "package_dir": { + "": "src" + }, + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "License :: OSI Approved :: CC0", + "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + "Topic :: Utilities" + ], + "keywords": [ + "license", + "filetype", + "urn", + "date", + "codec" + ], + "install_requires": [ + "py2-ipaddress >= 2.0, <3.0", + "url >= 0.1.4", + "publicsuffix2", + "nltk >= 2.0b4, <3.0.0", + "patch >= 1.14.2, < 1.15 ", + "bz2file >= 0.98", + "PyYAML >= 3.0, <4.0", + "Beautifulsoup >= 3.2.0, <4.0.0", + "Beautifulsoup4 >= 4.3.0, <5.0.0", + "html5lib", + "six", + "pygments >= 2.0.0, <3.0.0", + "pdfminer >= 20140328", + "chardet >= 2.1.1, <3.0.0", + "binaryornot >= 0.4.0", + "click >= 4.0.0, < 5.0.0", + "jinja2 >= 2.7.0, < 3.0.0", + "MarkupSafe >= 0.23", + "colorama", + "about-code-tool >= 0.9.0", + "requests >= 2.7.0, < 3.0.0" + ], + "extras_require": { + "base": [ + "certifi", + "setuptools", + "wheel", + "pip", + "wincertstore" + ], + "dev": [ + "pytest", + "execnet", + "py", + "pytest-xdist", + "bumpversion" + ], + "doc": "sphinx" + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/simple-setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/simple-setup.py-expected.json new file mode 100644 index 00000000000..f79beafae41 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/simple-setup.py-expected.json @@ -0,0 +1,343 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "scancode-toolkit", + "version": "1.5.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "ScanCode is a tool to scan code for license, copyright and other interesting facts.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "ScanCode", + "email": "info@scancode.io", + "url": null + } + ], + "keywords": [ + "license", + "filetype", + "urn", + "date", + "codec", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + "Topic :: Utilities" + ], + "homepage_url": "https://github.com/nexB/scancode-toolkit", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "(((apache-2.0 AND scancode-acknowledgment) AND cc0-1.0) AND unknown) AND apache-2.0 AND (free-unknown AND cc0-1.0)", + "declared_license": { + "license": "Apache-2.0 with ScanCode acknowledgment and CC0-1.0 and others", + "classifiers": [ + "License :: OSI Approved :: Apache Software License", + "License :: OSI Approved :: CC0" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:pypi/py2-ipaddress", + "extracted_requirement": "py2-ipaddress<3.0,>=2.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/url", + "extracted_requirement": "url>=0.1.4", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/publicsuffix2", + "extracted_requirement": "publicsuffix2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/nltk", + "extracted_requirement": "nltk<3.0.0,>=2.0b4", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/patch", + "extracted_requirement": "patch<1.15,>=1.14.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/bz2file", + "extracted_requirement": "bz2file>=0.98", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pyyaml", + "extracted_requirement": "PyYAML<4.0,>=3.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/beautifulsoup", + "extracted_requirement": "Beautifulsoup<4.0.0,>=3.2.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/beautifulsoup4", + "extracted_requirement": "Beautifulsoup4<5.0.0,>=4.3.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/html5lib", + "extracted_requirement": "html5lib", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/six", + "extracted_requirement": "six", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pygments", + "extracted_requirement": "pygments<3.0.0,>=2.0.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pdfminer", + "extracted_requirement": "pdfminer>=20140328", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/chardet", + "extracted_requirement": "chardet<3.0.0,>=2.1.1", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/binaryornot", + "extracted_requirement": "binaryornot>=0.4.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/click", + "extracted_requirement": "click<5.0.0,>=4.0.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/jinja2", + "extracted_requirement": "jinja2<3.0.0,>=2.7.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/markupsafe", + "extracted_requirement": "MarkupSafe>=0.23", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/colorama", + "extracted_requirement": "colorama", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/about-code-tool", + "extracted_requirement": "about-code-tool>=0.9.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/requests", + "extracted_requirement": "requests<3.0.0,>=2.7.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/certifi", + "extracted_requirement": "certifi", + "scope": "base", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/setuptools", + "extracted_requirement": "setuptools", + "scope": "base", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/wheel", + "extracted_requirement": "wheel", + "scope": "base", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pip", + "extracted_requirement": "pip", + "scope": "base", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/wincertstore", + "extracted_requirement": "wincertstore", + "scope": "base", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pytest", + "extracted_requirement": "pytest", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/execnet", + "extracted_requirement": "execnet", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/py", + "extracted_requirement": "py", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pytest-xdist", + "extracted_requirement": "pytest-xdist", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/bumpversion", + "extracted_requirement": "bumpversion", + "scope": "dev", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/scancode-toolkit", + "repository_download_url": "https://pypi.org/packages/source/s/scancode-toolkit/scancode-toolkit-1.5.0.tar.gz", + "api_data_url": "https://pypi.org/pypi/scancode-toolkit/1.5.0/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/scancode-toolkit@1.5.0" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/url_py_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/url_py_setup.py-expected-args.json new file mode 100644 index 00000000000..1f3daf5bfcb --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/url_py_setup.py-expected-args.json @@ -0,0 +1,20 @@ +{ + "name": "urlpy", + "version": "0.2.0.2", + "description": "URL Parsing", + "long_description": "\nSome helper functions for parsing URLs, sanitizing them, normalizing them in pure python.\n\nThis includes support for escaping, unescaping, punycoding, unpunycoding,\ncleaning parameter and query strings, and a little more sanitization.\n\nThis version is a friendly fork of the upstream from Moz to keep a pure Python\nversion around to run on Python 2.7 and all OSes.\nIt also uses an alternate publicsuffix list provider package.\n\n", + "author": "Dan Lecocq", + "author_email": "dan@seomoz.org", + "url": "http://github.com/nexB/url-py", + "license": "MIT", + "classifiers": [ + "License :: OSI Approved :: MIT License", + "Development Status :: 3 - Alpha", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "Topic :: Internet :: WWW/HTTP" + ], + "install_requires": [ + "publicsuffix2" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/url_py_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/url_py_setup.py-expected.json index c766a7a4556..4b04f242859 100644 --- a/tests/packagedcode/data/pypi/setup.py/url_py_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/url_py_setup.py-expected.json @@ -14,7 +14,7 @@ "type": "person", "role": "author", "name": "Dan Lecocq", - "email": null, + "email": "dan@seomoz.org", "url": null } ], diff --git a/tests/packagedcode/data/pypi/setup.py/venv_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/venv_setup.py-expected-args.json new file mode 100644 index 00000000000..5990a7a3a2f --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/venv_setup.py-expected-args.json @@ -0,0 +1,28 @@ +{ + "name": "virtualenv", + "description": "Virtual Python Environment builder", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5" + ], + "keywords": [ + "setuptools", + "deployment", + "installation", + "distutils" + ], + "author": "Ian Bicking", + "author_email": "ianb@colorstudy.com", + "maintainer": "Jannis Leidel, Carl Meyer and Brian Rosner", + "maintainer_email": "python-virtualenv@groups.google.com", + "url": "https://virtualenv.pypa.io/", + "license": "MIT" +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/venv_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/venv_setup.py-expected.json index ccfa974baee..febd94523ae 100644 --- a/tests/packagedcode/data/pypi/setup.py/venv_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/venv_setup.py-expected.json @@ -14,19 +14,22 @@ "type": "person", "role": "author", "name": "Ian Bicking", - "email": null, + "email": "ianb@colorstudy.com", "url": null }, { "type": "person", "role": "maintainer", "name": "Jannis Leidel, Carl Meyer and Brian Rosner", - "email": null, + "email": "python-virtualenv@groups.google.com", "url": null } ], "keywords": [ - "setuptools deployment installation distutils", + "setuptools", + "deployment", + "installation", + "distutils", "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Programming Language :: Python :: 2", diff --git a/tests/packagedcode/data/pypi/setup.py/whatsapp-play-setup.py b/tests/packagedcode/data/pypi/setup.py/whatsapp-play-setup.py new file mode 100644 index 00000000000..28fb7d3cb11 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/whatsapp-play-setup.py @@ -0,0 +1,70 @@ +from setuptools import setup, find_packages + +with open("README.md", "r") as f: + long_description = f.read() + +setup( + name="wplay", + version="8.0.7", + install_requires=["argparse >= 1.4.0", + "beautifulsoup4>=4.8.1", + "colorama>=0.4.3", + "dateTime>=4.3", + "decorator>=4.4.2", + "flake8>=3.7.9", + "google>=2.0.3", + "gTTS==2.1.1", + "newsapi-python>=0.2.6", + "phonenumbers==8.10.2", + "playsound>=1.2.2", + "prompt_toolkit==1.0.14", + "psutil>=5.7.0", + "pyfiglet>=0.8.post1", + "pyflakes>=2.2.0", + "Pygments>=2.6.1", + "pyppeteer>=0.0.25", + "python-dotenv==0.12.0", + "python-telegram-bot>=11.1.0", + "requests>=2.22.0", + "transitions>=0.7.2", + "urllib3>=1.25.8", + "websockets>=8.1", + "whaaaaat>=0.5.2", + ], + packages=find_packages(), + description="command line software to play with your WhatsApp", + long_description=long_description, + long_description_content_type="text/markdown", + author="Rohit Potter, Alexandre Calil", + author_email="rohitpotter12@gmail.com, alexandrecalilmf@gmail.com", + license="MIT", + python_requires=">=3.6", + url="https://github.com/rpotter12/whatsapp-play/", + download_url="https://pypi.org/project/wplay/", + keywords=[ + "whatsapp", + "whatsapp cli", + "whatsapp api", + "whatsapp service" + "whatsapp chat", + "message blast", + "message timer", + "whatsapp terminal", + "whatsapp news", + "whatsapp schedule", + "tracker", + "online tracking", + "save-chat" + ], + classifiers=[ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3 :: Only", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + entry_points={"console_scripts": ["wplay = wplay.__main__:main"]}, +) diff --git a/tests/packagedcode/data/pypi/setup.py/whatsapp-play-setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/whatsapp-play-setup.py-expected-args.json new file mode 100644 index 00000000000..648d3ed5c1e --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/whatsapp-play-setup.py-expected-args.json @@ -0,0 +1,62 @@ +{ + "name": "wplay", + "version": "8.0.7", + "install_requires": [ + "argparse >= 1.4.0", + "beautifulsoup4>=4.8.1", + "colorama>=0.4.3", + "dateTime>=4.3", + "decorator>=4.4.2", + "flake8>=3.7.9", + "google>=2.0.3", + "gTTS==2.1.1", + "newsapi-python>=0.2.6", + "phonenumbers==8.10.2", + "playsound>=1.2.2", + "prompt_toolkit==1.0.14", + "psutil>=5.7.0", + "pyfiglet>=0.8.post1", + "pyflakes>=2.2.0", + "Pygments>=2.6.1", + "pyppeteer>=0.0.25", + "python-dotenv==0.12.0", + "python-telegram-bot>=11.1.0", + "requests>=2.22.0", + "transitions>=0.7.2", + "urllib3>=1.25.8", + "websockets>=8.1", + "whaaaaat>=0.5.2" + ], + "description": "command line software to play with your WhatsApp", + "long_description_content_type": "text/markdown", + "author": "Rohit Potter, Alexandre Calil", + "author_email": "rohitpotter12@gmail.com, alexandrecalilmf@gmail.com", + "license": "MIT", + "python_requires": ">=3.6", + "url": "https://github.com/rpotter12/whatsapp-play/", + "download_url": "https://pypi.org/project/wplay/", + "keywords": [ + "whatsapp", + "whatsapp cli", + "whatsapp api", + "whatsapp servicewhatsapp chat", + "message blast", + "message timer", + "whatsapp terminal", + "whatsapp news", + "whatsapp schedule", + "tracker", + "online tracking", + "save-chat" + ], + "classifiers": [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3 :: Only", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/whatsapp-play-setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/whatsapp-play-setup.py-expected.json new file mode 100644 index 00000000000..92d125f3ca5 --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/whatsapp-play-setup.py-expected.json @@ -0,0 +1,291 @@ +[ + { + "type": "pypi", + "namespace": null, + "name": "wplay", + "version": "8.0.7", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "command line software to play with your WhatsApp", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Rohit Potter, Alexandre Calil", + "email": "rohitpotter12@gmail.com, alexandrecalilmf@gmail.com", + "url": null + } + ], + "keywords": [ + "whatsapp", + "whatsapp cli", + "whatsapp api", + "whatsapp servicewhatsapp chat", + "message blast", + "message timer", + "whatsapp terminal", + "whatsapp news", + "whatsapp schedule", + "tracker", + "online tracking", + "save-chat", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3 :: Only", + "Operating System :: OS Independent" + ], + "homepage_url": "https://github.com/rpotter12/whatsapp-play/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": "mit", + "declared_license": { + "license": "MIT", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "Download-URL": "https://pypi.org/project/wplay/", + "python_requires": ">=3.6" + }, + "dependencies": [ + { + "purl": "pkg:pypi/argparse", + "extracted_requirement": "argparse>=1.4.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/beautifulsoup4", + "extracted_requirement": "beautifulsoup4>=4.8.1", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/colorama", + "extracted_requirement": "colorama>=0.4.3", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/datetime", + "extracted_requirement": "dateTime>=4.3", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/decorator", + "extracted_requirement": "decorator>=4.4.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/flake8", + "extracted_requirement": "flake8>=3.7.9", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/google", + "extracted_requirement": "google>=2.0.3", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/gtts@2.1.1", + "extracted_requirement": "gTTS==2.1.1", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/newsapi-python", + "extracted_requirement": "newsapi-python>=0.2.6", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/phonenumbers@8.10.2", + "extracted_requirement": "phonenumbers==8.10.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/playsound", + "extracted_requirement": "playsound>=1.2.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/prompt-toolkit@1.0.14", + "extracted_requirement": "prompt_toolkit==1.0.14", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/psutil", + "extracted_requirement": "psutil>=5.7.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pyfiglet", + "extracted_requirement": "pyfiglet>=0.8.post1", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pyflakes", + "extracted_requirement": "pyflakes>=2.2.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pygments", + "extracted_requirement": "Pygments>=2.6.1", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pyppeteer", + "extracted_requirement": "pyppeteer>=0.0.25", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/python-dotenv@0.12.0", + "extracted_requirement": "python-dotenv==0.12.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/python-telegram-bot", + "extracted_requirement": "python-telegram-bot>=11.1.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/requests", + "extracted_requirement": "requests>=2.22.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/transitions", + "extracted_requirement": "transitions>=0.7.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/urllib3", + "extracted_requirement": "urllib3>=1.25.8", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/websockets", + "extracted_requirement": "websockets>=8.1", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/whaaaaat", + "extracted_requirement": "whaaaaat>=0.5.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/wplay", + "repository_download_url": "https://pypi.org/packages/source/w/wplay/wplay-8.0.7.tar.gz", + "api_data_url": "https://pypi.org/pypi/wplay/8.0.7/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/wplay@8.0.7" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/xmltodict_setup.py b/tests/packagedcode/data/pypi/setup.py/xmltodict_setup.py old mode 100755 new mode 100644 diff --git a/tests/packagedcode/data/pypi/setup.py/xmltodict_setup.py-expected-args.json b/tests/packagedcode/data/pypi/setup.py/xmltodict_setup.py-expected-args.json new file mode 100644 index 00000000000..300af3305dc --- /dev/null +++ b/tests/packagedcode/data/pypi/setup.py/xmltodict_setup.py-expected-args.json @@ -0,0 +1,30 @@ +{ + "name": "xmltodict", + "author_email": "martinblech@gmail.com", + "url": "https://github.com/martinblech/xmltodict", + "platforms": [ + "all" + ], + "classifiers": [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.5", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: Implementation :: Jython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Text Processing :: Markup :: XML" + ], + "tests_require": [ + "nose>=1.0", + "coverage" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/setup.py/xmltodict_setup.py-expected.json b/tests/packagedcode/data/pypi/setup.py/xmltodict_setup.py-expected.json index 235539d68ea..e4adf0b744a 100644 --- a/tests/packagedcode/data/pypi/setup.py/xmltodict_setup.py-expected.json +++ b/tests/packagedcode/data/pypi/setup.py/xmltodict_setup.py-expected.json @@ -9,7 +9,15 @@ "primary_language": "Python", "description": "", "release_date": null, - "parties": [], + "parties": [ + { + "type": "person", + "role": "author", + "name": null, + "email": "martinblech@gmail.com", + "url": null + } + ], "keywords": [ "Intended Audience :: Developers", "Operating System :: OS Independent", diff --git a/tests/packagedcode/data/pypi/site-packages/site-packages-expected.json b/tests/packagedcode/data/pypi/site-packages/site-packages-expected.json index f2e599ac4a1..98efd72665a 100644 --- a/tests/packagedcode/data/pypi/site-packages/site-packages-expected.json +++ b/tests/packagedcode/data/pypi/site-packages/site-packages-expected.json @@ -120,8 +120,8 @@ "md5": null, "sha256": null, "sha512": null, - "bug_tracking_url": "Issue Tracker, https://github.com/pallets/click/issues/", - "code_view_url": "Source Code, https://github.com/pallets/click/", + "bug_tracking_url": "https://github.com/pallets/click/issues/", + "code_view_url": "https://github.com/pallets/click/", "vcs_url": null, "copyright": null, "license_expression": "bsd-new AND bsd-new", @@ -134,11 +134,11 @@ "notice_text": null, "source_packages": [], "extra_data": { - "Donate": "Donate, https://palletsprojects.com/donate", - "Documentation": "Documentation, https://click.palletsprojects.com/", - "Changes": "Changes, https://click.palletsprojects.com/changes/", - "Twitter": "Twitter, https://twitter.com/PalletsTeam", - "Chat": "Chat, https://discord.gg/pallets" + "Donate": "https://palletsprojects.com/donate", + "Documentation": "https://click.palletsprojects.com/", + "Changes": "https://click.palletsprojects.com/changes/", + "Twitter": "https://twitter.com/PalletsTeam", + "Chat": "https://discord.gg/pallets" }, "repository_homepage_url": "https://pypi.org/project/click", "repository_download_url": "https://pypi.org/packages/source/c/click/click-8.0.4.tar.gz", @@ -305,8 +305,8 @@ "md5": null, "sha256": null, "sha512": null, - "bug_tracking_url": "Issue Tracker, https://github.com/pallets/click/issues/", - "code_view_url": "Source Code, https://github.com/pallets/click/", + "bug_tracking_url": "https://github.com/pallets/click/issues/", + "code_view_url": "https://github.com/pallets/click/", "vcs_url": null, "copyright": null, "license_expression": "bsd-new AND bsd-new", @@ -690,11 +690,11 @@ } ], "extra_data": { - "Donate": "Donate, https://palletsprojects.com/donate", - "Documentation": "Documentation, https://click.palletsprojects.com/", - "Changes": "Changes, https://click.palletsprojects.com/changes/", - "Twitter": "Twitter, https://twitter.com/PalletsTeam", - "Chat": "Chat, https://discord.gg/pallets" + "Donate": "https://palletsprojects.com/donate", + "Documentation": "https://click.palletsprojects.com/", + "Changes": "https://click.palletsprojects.com/changes/", + "Twitter": "https://twitter.com/PalletsTeam", + "Chat": "https://discord.gg/pallets" }, "dependencies": [ { @@ -821,7 +821,7 @@ "type": "person", "role": "author", "name": "odoku", - "email": null, + "email": "masashi.onogawa@wamw.jp", "url": null } ], @@ -866,6 +866,24 @@ "is_optional": false, "is_resolved": false, "resolved_package": {} + }, + { + "purl": "pkg:pypi/django", + "extracted_requirement": "django", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/pytest@2.9.1", + "extracted_requirement": "pytest==2.9.1", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} } ], "repository_homepage_url": "https://pypi.org/project/PyJPString", diff --git a/tests/packagedcode/data/pypi/solo-setup/expected.json b/tests/packagedcode/data/pypi/solo-setup/expected.json new file mode 100644 index 00000000000..329a17df7e2 --- /dev/null +++ b/tests/packagedcode/data/pypi/solo-setup/expected.json @@ -0,0 +1,118 @@ +{ + "dependencies": [], + "packages": [], + "files": [ + { + "path": "setup.py", + "type": "file", + "package_data": [ + { + "type": "pypi", + "namespace": null, + "name": "cdp-seattle-backend", + "version": "1.0.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Package containing the gather functions for Example.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Council Data Project Contributors", + "email": null, + "url": null + } + ], + "keywords": [ + "civic technology", + "open government", + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python :: 3.9" + ], + "homepage_url": "https://github.com/CouncilDataProject/seattle", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": { + "license": "MIT license", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "python_requires": ">=3.9" + }, + "dependencies": [ + { + "purl": "pkg:pypi/cdp-backend@3.0.16", + "extracted_requirement": "cdp-backend[pipeline]==3.0.16", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/cdp-scrapers", + "extracted_requirement": "cdp-scrapers>=0.4.0", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/black", + "extracted_requirement": "black>=19.10b0", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/flake8", + "extracted_requirement": "flake8>=3.8.3", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:pypi/flake8-debugger", + "extracted_requirement": "flake8-debugger>=3.2.1", + "scope": "test", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/cdp-seattle-backend", + "repository_download_url": "https://pypi.org/packages/source/c/cdp-seattle-backend/cdp-seattle-backend-1.0.0.tar.gz", + "api_data_url": "https://pypi.org/pypi/cdp-seattle-backend/1.0.0/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/cdp-seattle-backend@1.0.0" + } + ], + "for_packages": [], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/solo-setup/setup.py b/tests/packagedcode/data/pypi/solo-setup/setup.py new file mode 100644 index 00000000000..1108904b9bc --- /dev/null +++ b/tests/packagedcode/data/pypi/solo-setup/setup.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +"""The setup script.""" + +from setuptools import find_packages, setup + +test_requirements = [ + "black>=19.10b0", + "flake8>=3.8.3", + "flake8-debugger>=3.2.1", +] + +dev_requirements = [ + *test_requirements, + "wheel>=0.34.2", +] + +requirements = [ + "cdp-backend[pipeline]==3.0.16", + "cdp-scrapers>=0.4.0", +] + +extra_requirements = { + "test": test_requirements, + "dev": dev_requirements, + "all": [ + *requirements, + *dev_requirements, + ], +} + +setup( + author="Council Data Project Contributors", + classifiers=[ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3.9", + ], + description="Package containing the gather functions for Example.", + install_requires=requirements, + license="MIT license", + long_description_content_type="text/markdown", + include_package_data=True, + keywords="civic technology, open government", + name="cdp-seattle-backend", + packages=find_packages(exclude=["tests", "*.tests", "*.tests.*"]), + python_requires=">=3.9", + tests_require=test_requirements, + extras_require=extra_requirements, + url="https://github.com/CouncilDataProject/seattle", + version="1.0.0", + zip_safe=False, +) diff --git a/tests/packagedcode/data/pypi/source-package/pip-22.0.4-pypi-package-expected.json b/tests/packagedcode/data/pypi/source-package/pip-22.0.4-pypi-package-expected.json index 65b456967dc..da72d78d843 100644 --- a/tests/packagedcode/data/pypi/source-package/pip-22.0.4-pypi-package-expected.json +++ b/tests/packagedcode/data/pypi/source-package/pip-22.0.4-pypi-package-expected.json @@ -42,7 +42,7 @@ "sha256": null, "sha512": null, "bug_tracking_url": null, - "code_view_url": "Source, https://github.com/pypa/pip", + "code_view_url": "https://github.com/pypa/pip", "vcs_url": null, "copyright": null, "license_expression": "mit AND mit", @@ -55,8 +55,8 @@ "notice_text": null, "source_packages": [], "extra_data": { - "Documentation": "Documentation, https://pip.pypa.io", - "Changelog": "Changelog, https://pip.pypa.io/en/stable/news/" + "Documentation": "https://pip.pypa.io", + "Changelog": "https://pip.pypa.io/en/stable/news/" }, "repository_homepage_url": "https://pypi.org/project/pip", "repository_download_url": "https://pypi.org/packages/source/p/pip/pip-22.0.4.tar.gz", @@ -153,7 +153,7 @@ "sha256": null, "sha512": null, "bug_tracking_url": null, - "code_view_url": "Source, https://github.com/pypa/pip", + "code_view_url": "https://github.com/pypa/pip", "vcs_url": null, "copyright": null, "license_expression": "mit AND mit", @@ -167,8 +167,8 @@ "source_packages": [], "file_references": [], "extra_data": { - "Documentation": "Documentation, https://pip.pypa.io", - "Changelog": "Changelog, https://pip.pypa.io/en/stable/news/" + "Documentation": "https://pip.pypa.io", + "Changelog": "https://pip.pypa.io/en/stable/news/" }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/pip", @@ -429,7 +429,7 @@ "type": "person", "role": "author", "name": "The pip developers", - "email": null, + "email": "distutils-sig@python.org", "url": null } ], @@ -455,7 +455,7 @@ "sha256": null, "sha512": null, "bug_tracking_url": null, - "code_view_url": null, + "code_view_url": "https://github.com/pypa/pip", "vcs_url": null, "copyright": null, "license_expression": null, @@ -468,7 +468,11 @@ "notice_text": null, "source_packages": [], "file_references": [], - "extra_data": {}, + "extra_data": { + "Documentation": "https://pip.pypa.io", + "Changelog": "https://pip.pypa.io/en/stable/news/", + "python_requires": ">=3.7" + }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/pip", "repository_download_url": "https://pypi.org/packages/source/p/pip/pip-22.0.4.tar.gz", @@ -548,7 +552,7 @@ "sha256": null, "sha512": null, "bug_tracking_url": null, - "code_view_url": "Source, https://github.com/pypa/pip", + "code_view_url": "https://github.com/pypa/pip", "vcs_url": null, "copyright": null, "license_expression": "mit AND mit", @@ -716,8 +720,8 @@ } ], "extra_data": { - "Documentation": "Documentation, https://pip.pypa.io", - "Changelog": "Changelog, https://pip.pypa.io/en/stable/news/" + "Documentation": "https://pip.pypa.io", + "Changelog": "https://pip.pypa.io/en/stable/news/" }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/pip", diff --git a/tests/packagedcode/data/pypi/source-package/pip-22.0.4-pypi-package-setup-expected.json b/tests/packagedcode/data/pypi/source-package/pip-22.0.4-pypi-package-setup-expected.json new file mode 100644 index 00000000000..cdd81da4662 --- /dev/null +++ b/tests/packagedcode/data/pypi/source-package/pip-22.0.4-pypi-package-setup-expected.json @@ -0,0 +1,80 @@ +{ + "dependencies": [], + "packages": [], + "files": [ + { + "path": "setup.py", + "type": "file", + "package_data": [ + { + "type": "pypi", + "namespace": null, + "name": "pip", + "version": "22.0.4", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "The PyPA recommended tool for installing Python packages.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "The pip developers", + "email": "distutils-sig@python.org", + "url": null + } + ], + "keywords": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Build Tools", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy" + ], + "homepage_url": "https://pip.pypa.io/", + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": "https://github.com/pypa/pip", + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": { + "license": "MIT", + "classifiers": [ + "License :: OSI Approved :: MIT License" + ] + }, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": { + "Documentation": "https://pip.pypa.io", + "Changelog": "https://pip.pypa.io/en/stable/news/", + "python_requires": ">=3.7" + }, + "dependencies": [], + "repository_homepage_url": "https://pypi.org/project/pip", + "repository_download_url": "https://pypi.org/packages/source/p/pip/pip-22.0.4.tar.gz", + "api_data_url": "https://pypi.org/pypi/pip/22.0.4/json", + "datasource_id": "pypi_setup_py", + "purl": "pkg:pypi/pip@22.0.4" + } + ], + "for_packages": [], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/unpackage_source_parser-expected.json b/tests/packagedcode/data/pypi/unpackage_source_parser-expected.json deleted file mode 100644 index 27db5ddee91..00000000000 --- a/tests/packagedcode/data/pypi/unpackage_source_parser-expected.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "type": "pypi", - "namespace": null, - "name": "TicketImport", - "version": "0.7a", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "Import CSV and Excel files", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Francois Granade", - "email": "fg@nexb.com", - "url": null - } - ], - "keywords": [], - "homepage_url": "http://nexb.com", - "download_url": null, - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": null, - "copyright": null, - "license_expression": "unknown", - "declared_license": { - "license": "BSD" - }, - "notice_text": null, - "dependencies": [], - "source_packages": [], - "extra_data": {}, - "purl": "pkg:pypi/ticketimport@0.7a", - "repository_homepage_url": "https://pypi.org/project/TicketImport", - "repository_download_url": "https://pypi.io/packages/source/T/TicketImport/TicketImport-0.7a.tar.gz", - "api_data_url": "http://pypi.python.org/pypi/TicketImport/0.7a/json" -} \ No newline at end of file diff --git a/tests/packagedcode/data/pypi/unpacked_sdist/metadata-1.1/python-mimeparse-1.6.0-expected.json b/tests/packagedcode/data/pypi/unpacked_sdist/metadata-1.1/python-mimeparse-1.6.0-expected.json index 9a403b9a93b..2e9c0413aca 100644 --- a/tests/packagedcode/data/pypi/unpacked_sdist/metadata-1.1/python-mimeparse-1.6.0-expected.json +++ b/tests/packagedcode/data/pypi/unpacked_sdist/metadata-1.1/python-mimeparse-1.6.0-expected.json @@ -37,7 +37,7 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": "https://github.com/dbtsai/python-mimeparse/tarball/1.6.0", + "vcs_url": null, "copyright": null, "license_expression": "mit", "declared_license": { @@ -48,7 +48,9 @@ "notice_text": null, "source_packages": [], "file_references": [], - "extra_data": {}, + "extra_data": { + "Download-URL": "https://github.com/dbtsai/python-mimeparse/tarball/1.6.0" + }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/python-mimeparse", "repository_download_url": "https://pypi.org/packages/source/p/python-mimeparse/python-mimeparse-1.6.0.tar.gz", diff --git a/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.0/python_mimeparse-1.6.0.dist-info-expected.json b/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.0/python_mimeparse-1.6.0.dist-info-expected.json index 4d02d14fb75..1348eba4f59 100644 --- a/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.0/python_mimeparse-1.6.0.dist-info-expected.json +++ b/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.0/python_mimeparse-1.6.0.dist-info-expected.json @@ -37,7 +37,7 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": "https://github.com/dbtsai/python-mimeparse/tarball/1.6.0", + "vcs_url": null, "copyright": null, "license_expression": "mit", "declared_license": { @@ -112,7 +112,9 @@ "extra_data": {} } ], - "extra_data": {}, + "extra_data": { + "Download-URL": "https://github.com/dbtsai/python-mimeparse/tarball/1.6.0" + }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/python-mimeparse", "repository_download_url": "https://pypi.org/packages/source/p/python-mimeparse/python-mimeparse-1.6.0.tar.gz", diff --git a/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.0/urllib3-1.26.4.dist-info-expected.json b/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.0/urllib3-1.26.4.dist-info-expected.json index 9d8f64cdd98..82183f3ec58 100644 --- a/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.0/urllib3-1.26.4.dist-info-expected.json +++ b/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.0/urllib3-1.26.4.dist-info-expected.json @@ -44,8 +44,8 @@ "md5": null, "sha256": null, "sha512": null, - "bug_tracking_url": "Issue tracker, https://github.com/urllib3/urllib3/issues", - "code_view_url": "Code, https://github.com/urllib3/urllib3", + "bug_tracking_url": "https://github.com/urllib3/urllib3/issues", + "code_view_url": "https://github.com/urllib3/urllib3", "vcs_url": null, "copyright": null, "license_expression": "mit AND mit", @@ -834,7 +834,7 @@ } ], "extra_data": { - "Documentation": "Documentation, https://urllib3.readthedocs.io/" + "Documentation": "https://urllib3.readthedocs.io/" }, "dependencies": [ { diff --git a/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.1/haruka_bot-1.2.3.dist-info-expected.json b/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.1/haruka_bot-1.2.3.dist-info-expected.json index ea129b26531..2146095a0fe 100644 --- a/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.1/haruka_bot-1.2.3.dist-info-expected.json +++ b/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.1/haruka_bot-1.2.3.dist-info-expected.json @@ -37,7 +37,7 @@ "sha512": null, "bug_tracking_url": null, "code_view_url": null, - "vcs_url": "Repository, https://github.com/SK-415/HarukaBot/tree/master/src/plugins/haruka_bot", + "vcs_url": "https://github.com/SK-415/HarukaBot/tree/master/src/plugins/haruka_bot", "copyright": null, "license_expression": "agpl-3.0-plus AND agpl-3.0-plus", "declared_license": { @@ -231,7 +231,7 @@ } ], "extra_data": { - "Documentation": "Documentation, https://github.com/SK-415/HarukaBot#readme" + "Documentation": "https://github.com/SK-415/HarukaBot#readme" }, "dependencies": [ { diff --git a/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.1/pip-20.2.2.dist-info-expected.json b/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.1/pip-20.2.2.dist-info-expected.json index 9cf792ad546..30a13ada54a 100644 --- a/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.1/pip-20.2.2.dist-info-expected.json +++ b/tests/packagedcode/data/pypi/unpacked_wheel/metadata-2.1/pip-20.2.2.dist-info-expected.json @@ -42,7 +42,7 @@ "sha256": null, "sha512": null, "bug_tracking_url": null, - "code_view_url": "Source, https://github.com/pypa/pip", + "code_view_url": "https://github.com/pypa/pip", "vcs_url": null, "copyright": null, "license_expression": "mit AND mit", @@ -7293,8 +7293,8 @@ } ], "extra_data": { - "Documentation": "Documentation, https://pip.pypa.io", - "Changelog": "Changelog, https://pip.pypa.io/en/stable/news/" + "Documentation": "https://pip.pypa.io", + "Changelog": "https://pip.pypa.io/en/stable/news/" }, "dependencies": [], "repository_homepage_url": "https://pypi.org/project/pip", diff --git a/tests/packagedcode/packages_test_utils.py b/tests/packagedcode/packages_test_utils.py index 6d4d7356486..393a64240c7 100644 --- a/tests/packagedcode/packages_test_utils.py +++ b/tests/packagedcode/packages_test_utils.py @@ -22,7 +22,12 @@ class PackageTester(testcase.FileBasedTesting): test_data_dir = os.path.join(os.path.dirname(__file__), 'data') - def check_package_data(self, package_data, expected_loc, regen=REGEN_TEST_FIXTURES): + def check_package_data( + self, + package_data, + expected_loc, + regen=REGEN_TEST_FIXTURES, + ): """ Helper to test a package object against an expected JSON file. """ @@ -43,7 +48,7 @@ def check_packages_data( expected_loc, must_exist=True, remove_uuid=True, - regen=REGEN_TEST_FIXTURES + regen=REGEN_TEST_FIXTURES, ): """ Helper to test a list of package_data objects against an expected JSON file. diff --git a/tests/packagedcode/test_build_gradle.py b/tests/packagedcode/test_build_gradle.py index 0f745dc2f93..74249364af9 100644 --- a/tests/packagedcode/test_build_gradle.py +++ b/tests/packagedcode/test_build_gradle.py @@ -7,90 +7,62 @@ # See https://aboutcode.org for more information about nexB OSS projects. # -import os.path - -import pytest +import os from packagedcode import build_gradle +from packages_test_utils import build_tests from packages_test_utils import PackageTester +from packages_test_utils import compute_and_set_license_expression from scancode.cli_test_utils import check_json_scan from scancode.cli_test_utils import run_scan_click from scancode_config import REGEN_TEST_FIXTURES +test_data_dir = os.path.join(os.path.dirname(__file__), 'data') + class TestBuildGradle(PackageTester): - test_data_dir = os.path.join(os.path.dirname(__file__), 'data') + test_data_dir = test_data_dir def test_end2end_scan_can_detect_build_gradle(self): - test_file = self.get_test_loc('build_gradle/build.gradle') - expected_file = self.get_test_loc('build_gradle/end2end-expected.json') + test_file = self.get_test_loc('build_gradle/end2end/build.gradle') + expected_file = self.get_test_loc('build_gradle/end2end/build.gradle-expected.json') result_file = self.get_temp_file() run_scan_click(['--package', test_file, '--json-pp', result_file]) check_json_scan(expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES) - def test_BuildGradleHandler_parse_basic(self): - test_file = self.get_test_loc('build_gradle/build.gradle') - packages_data = build_gradle.BuildGradleHandler.parse(test_file) - expected_file = self.get_test_loc('build_gradle/build.gradle-parse-expected.json', must_exist=False) - self.check_packages_data( - packages_data=packages_data, - expected_loc=expected_file, - must_exist=False, - regen=REGEN_TEST_FIXTURES, - ) - - def test_BuildGradleHandler_parse_groovy1(self): - test_file = self.get_test_loc('build_gradle/groovy1/build.gradle') - packages_data = build_gradle.BuildGradleHandler.parse(test_file) - expected_file = test_file + '-parse-expected.json' - self.check_packages_data( - packages_data=packages_data, - expected_loc=expected_file, - must_exist=False, - regen=REGEN_TEST_FIXTURES, - ) - - def test_BuildGradleHandler_parse_groovy2(self): - test_file = self.get_test_loc('build_gradle/groovy2/build.gradle') - packages_data = build_gradle.BuildGradleHandler.parse(test_file) - expected_file = test_file + '-parse-expected.json' - self.check_packages_data( - packages_data=packages_data, - expected_loc=expected_file, - must_exist=False, - regen=REGEN_TEST_FIXTURES, - ) - - @pytest.mark.xfail(reason='Some gradle constructions are not yet handled correctly') - def test_BuildGradleHandler_parse_groovy3(self): - test_file = self.get_test_loc('build_gradle/groovy3/build.gradle') - packages_data = build_gradle.BuildGradleHandler.parse(test_file) - expected_file = test_file + '-parse-expected.json' - self.check_packages_data( - packages_data=packages_data, - expected_loc=expected_file, - must_exist=False, - regen=REGEN_TEST_FIXTURES, - ) - - def test_BuildGradleHandler_parse_kotlin1(self): - test_file = self.get_test_loc('build_gradle/kotlin1/build.gradle.kts') - packages_data = build_gradle.BuildGradleHandler.parse(test_file) - expected_file = test_file + '-parse-expected.json' - self.check_packages_data( - packages_data=packages_data, - expected_loc=expected_file, - must_exist=False, - regen=REGEN_TEST_FIXTURES, - ) - - def test_BuildGradleHandler_parse_kotlin2(self): - test_file = self.get_test_loc('build_gradle/kotlin2/build.gradle.kts') - packages_data = build_gradle.BuildGradleHandler.parse(test_file) - expected_file = test_file + '-parse-expected.json' - self.check_packages_data( - packages_data=packages_data, - expected_loc=expected_file, - must_exist=False, - regen=REGEN_TEST_FIXTURES, - ) + +def check_gradle_parse(location): + packages_data = build_gradle.BuildGradleHandler.parse(location) + results = [] + for package_data in packages_data: + compute_and_set_license_expression(package_data) + results.append(package_data.to_dict()) + return results + + +class TestBuildGradleGroovy(PackageTester): + test_data_dir = test_data_dir + + +build_tests( + test_dir=os.path.join(test_data_dir, 'build_gradle/groovy'), + clazz=TestBuildGradleGroovy, + test_method_prefix='test_', + tested_function=check_gradle_parse, + test_file_suffix='.gradle', + regen=REGEN_TEST_FIXTURES, +) + + +class TestBuildGradleKotlin(PackageTester): + test_data_dir = test_data_dir + + +build_tests( + test_dir=os.path.join(test_data_dir, 'build_gradle/kotlin'), + clazz=TestBuildGradleGroovy, + test_method_prefix='test_', + tested_function=check_gradle_parse, + test_file_suffix='.gradle.kts', + regen=REGEN_TEST_FIXTURES, +) diff --git a/tests/packagedcode/test_pypi.py b/tests/packagedcode/test_pypi.py index ce3c81672e1..4f86afba7ee 100644 --- a/tests/packagedcode/test_pypi.py +++ b/tests/packagedcode/test_pypi.py @@ -7,7 +7,6 @@ # See https://aboutcode.org for more information about nexB OSS projects. # -import json import os from unittest.case import skipIf @@ -32,6 +31,13 @@ def test_package_scan_pypi_end_to_end(self): run_scan_click(['--package', '--strip-root', '--processes', '-1', test_dir, '--json', result_file]) check_json_scan(expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES) + def test_package_scan_pypi_setup_py_end_to_end(self): + test_dir = self.get_test_loc('pypi/source-package/pip-22.0.4/setup.py') + result_file = self.get_temp_file('json') + expected_file = self.get_test_loc('pypi/source-package/pip-22.0.4-pypi-package-setup-expected.json', must_exist=False) + run_scan_click(['--package', '--strip-root', '--processes', '-1', test_dir, '--json', result_file]) + check_json_scan(expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES) + def test_package_scan_pypi_end_to_end_skip_site_packages(self): test_dir = self.get_test_loc('pypi/site-packages/codebase') result_file = self.get_temp_file('json') @@ -39,6 +45,18 @@ def test_package_scan_pypi_end_to_end_skip_site_packages(self): run_scan_click(['--package', '--strip-root', '--processes', '-1', test_dir, '--json', result_file]) check_json_scan(expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES) + def test_package_scan_pypi_end_to_end_can_handle_solo_setup_py(self): + test_dir = self.get_test_loc('pypi/solo-setup/setup.py') + result_file = self.get_temp_file('json') + expected_file = self.get_test_loc('pypi/solo-setup/expected.json') + run_scan_click(['--package', '--processes', '-1', test_dir, '--json-pp', result_file]) + check_json_scan(expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES) + + def test_detect_version_attribute_setup_py(self): + test_loc = self.get_test_loc('pypi/source-package/pip-22.0.4/setup.py') + result = pypi.detect_version_attribute(test_loc) + assert result == '22.0.4' + class TestPyPiDevelopEggInfoPkgInfo(PackageTester): test_data_dir = os.path.join(os.path.dirname(__file__), 'data') @@ -207,30 +225,6 @@ def test_parse_metadata_unpacked_sdist_metadata_v10_subdir(self): expected_loc = self.get_test_loc('pypi/unpacked_sdist/metadata-1.0/PyJPString-0.0.3-subdir-expected.json') self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_with_name(self): - test_file = self.get_test_loc('pypi/setup.py/with_name-setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/with_name-setup.py.expected.json', must_exist=False) - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - - def test_parse_setup_py_without_name(self): - test_file = self.get_test_loc('pypi/setup.py/without_name-setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/without_name-setup.py.expected.json', must_exist=False) - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - - def test_get_setup_py_args_with_name(self): - test_file = self.get_test_loc('pypi/setup.py/with_name-setup.py') - kwargs = pypi.get_setup_py_args(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/with_name-setup.py.args.expected.json', must_exist=False) - check_result_equals_expected_json(kwargs, expected_loc, regen=REGEN_TEST_FIXTURES) - - def test_get_setup_py_args_without_name(self): - test_file = self.get_test_loc('pypi/setup.py/without_name-setup.py') - kwargs = pypi.get_setup_py_args(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/without_name-setup.py.args.expected.json', must_exist=False) - check_result_equals_expected_json(kwargs, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_metadata_unpacked_sdist_metadata_v11_1(self): test_file = self.get_test_loc('pypi/unpacked_sdist/metadata-1.1/python-mimeparse-1.6.0/PKG-INFO') package = pypi.PythonSdistPkgInfoFile.parse(test_file) @@ -272,12 +266,11 @@ def test_python_requirements_is_package_data_file(self): def test_get_requirements_txt_dependencies(self): test_file = self.get_test_loc('pypi/requirements_txt/simple/requirements.txt') - dependencies = [ - d.to_dict() - for d in pypi.get_requirements_txt_dependencies(location=test_file) - ] + dependencies, extra_data = pypi.get_requirements_txt_dependencies(location=test_file) + dependencies = [d.to_dict() for d in dependencies] + results = dependencies, extra_data expected_loc = self.get_test_loc('pypi/requirements_txt/simple/output.expected.json') - check_result_equals_expected_json(dependencies, expected_loc, regen=REGEN_TEST_FIXTURES) + check_result_equals_expected_json(results, expected_loc, regen=REGEN_TEST_FIXTURES) def test_parse_dependency_file_basic(self): test_file = self.get_test_loc('pypi/requirements_txt/basic/requirements.txt') @@ -512,201 +505,98 @@ def test_is_not_requirements_file(self, monkeypatch): assert not pypi.PipRequirementsFileHandler.is_datafile('requiremenst.py') -def get_setup_py_test_files(test_dir): - """ - Yield tuples of (setup.py file, expected JSON file) from a `test_dir` test - data directory. - """ - for top, _, files in os.walk(test_dir): - for tfile in files: - if tfile.endswith('setup.py'): - continue - test_loc = os.path.join(top, tfile) - expected_loc = test_loc + '-expected.json' - yield test_loc, expected_loc - - -class TestSetupPyVersions(object): - test_data_dir = os.path.abspath(os.path.join( - os.path.dirname(__file__), - 'data', - 'setup.py-versions', - )) - - @pytest.mark.parametrize('test_loc, expected_loc', list(get_setup_py_test_files(test_data_dir))) - def test_parse_setup_py_with_computed_versions(self, test_loc, expected_loc, regen=REGEN_TEST_FIXTURES): - package = pypi.PythonSetupPyHandler.parse(test_loc) - if package: - results = package.to_dict() - else: - results = {} - - if regen: - with open(expected_loc, 'w') as ex: - json.dump(results, ex, indent=2, separators=(',', ': ')) - - with open(expected_loc) as ex: - expected = json.load(ex) - - try: - assert results == expected - except AssertionError: - assert json.dumps(results, indent=2) == json.dumps(expected, indent=2) - - -class TestPyPiSetupPy(PackageTester): +class TestPyPiSetupPyNotWin(PackageTester): test_data_dir = os.path.join(os.path.dirname(__file__), 'data') @skipIf(on_windows, 'Somehow this fails on Windows') def test_parse_setup_py_arpy(self): - test_file = self.get_test_loc('pypi/setup.py/arpy_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/arpy_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - - def test_parse_setup_py_pluggy(self): - test_file = self.get_test_loc('pypi/setup.py/pluggy_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/pluggy_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - - def test_parse_setup_py_pygtrie(self): - # this uses a kwargs dict - test_file = self.get_test_loc('pypi/setup.py/pygtrie_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/pygtrie_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - - def test_parse_setup_py_basic(self): - test_file = self.get_test_loc('pypi/setup.py/simple-setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - - def test_parse_setup_py_boolean2_py(self): - test_file = self.get_test_loc('pypi/setup.py/boolean2_py_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/boolean2_py_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - - def test_parse_setup_py_container_check(self): - test_file = self.get_test_loc('pypi/setup.py/container_check_setup.py') + test_file = self.get_test_loc('pypi/setup.py-not-win/arpy_setup.py') package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/container_check_setup.py-expected.json') + expected_loc = self.get_test_loc('pypi/setup.py-not-win/arpy_setup.py-expected.json') self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_fb303_py(self): - test_file = self.get_test_loc('pypi/setup.py/fb303_py_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/fb303_py_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_frell_src(self): - # setup.py is a temaplte with @vars - test_file = self.get_test_loc('pypi/setup.py/frell_src_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/frell_src_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) +class TestPyPiSetupPyNames(PackageTester): + test_data_dir = os.path.join(os.path.dirname(__file__), 'data') - def test_parse_setup_py_gyp(self): - test_file = self.get_test_loc('pypi/setup.py/gyp_setup.py') + def test_parse_setup_py_with_name(self): + test_file = self.get_test_loc('pypi/setup.py-name-or-no-name/with_name-setup.py') package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/gyp_setup.py-expected.json') + expected_loc = self.get_test_loc('pypi/setup.py-name-or-no-name/with_name-setup.py.expected.json', must_exist=False) self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_interlap(self): - test_file = self.get_test_loc('pypi/setup.py/interlap_setup.py') + def test_parse_setup_py_without_name(self): + test_file = self.get_test_loc('pypi/setup.py-name-or-no-name/without_name-setup.py') package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/interlap_setup.py-expected.json') + expected_loc = self.get_test_loc('pypi/setup.py-name-or-no-name/without_name-setup.py.expected.json', must_exist=False) self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_mb(self): - test_file = self.get_test_loc('pypi/setup.py/mb_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/mb_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) + def test_get_setup_py_args_with_name(self): + test_file = self.get_test_loc('pypi/setup.py-name-or-no-name/with_name-setup.py') + kwargs = pypi.get_setup_py_args(test_file) + expected_loc = self.get_test_loc('pypi/setup.py-name-or-no-name/with_name-setup.py.args.expected.json', must_exist=False) + check_result_equals_expected_json(kwargs, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_ntfs(self): - test_file = self.get_test_loc('pypi/setup.py/ntfs_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/ntfs_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) + def test_get_setup_py_args_without_name(self): + test_file = self.get_test_loc('pypi/setup.py-name-or-no-name/without_name-setup.py') + kwargs = pypi.get_setup_py_args(test_file) + expected_loc = self.get_test_loc('pypi/setup.py-name-or-no-name/without_name-setup.py.args.expected.json', must_exist=False) + check_result_equals_expected_json(kwargs, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_nvchecker(self): - test_file = self.get_test_loc('pypi/setup.py/nvchecker_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/nvchecker_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_oi_agents_common_code(self): - test_file = self.get_test_loc('pypi/setup.py/oi_agents_common_code_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/oi_agents_common_code_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) +def get_setup_py_test_files(test_dir): + """ + Yield setup.py file from a `test_dir` test data directory. + """ + print(test_dir) + for top, _, files in os.walk(test_dir): + for tfile in files: + if tfile.endswith('setup.py'): + yield os.path.join(top, tfile) - def test_parse_setup_py_packageurl_python(self): - test_file = self.get_test_loc('pypi/setup.py/packageurl_python_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/packageurl_python_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_pipdeptree(self): - test_file = self.get_test_loc('pypi/setup.py/pipdeptree_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/pipdeptree_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) +def check_setup_py_parsing(test_loc): + expected_loc1 = f'{test_loc}-expected-args.json' + parsed_kwargs = pypi.get_setup_py_args(test_loc, include_not_parsable=False) + check_result_equals_expected_json( + result=parsed_kwargs, + expected_loc=expected_loc1, + regen=REGEN_TEST_FIXTURES, + ) - def test_parse_setup_py_pydep(self): - test_file = self.get_test_loc('pypi/setup.py/pydep_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/pydep_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) + expected_loc2 = f'{test_loc}-expected.json' + packages_data = pypi.PythonSetupPyHandler.parse(test_loc) + test_envt.check_packages_data( + packages_data=packages_data, + expected_loc=expected_loc2, + regen=REGEN_TEST_FIXTURES, + must_exist=False, + ) - def test_parse_setup_py_pyrpm_2(self): - test_file = self.get_test_loc('pypi/setup.py/pyrpm_2_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/pyrpm_2_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_python_publicsuffix(self): - test_file = self.get_test_loc('pypi/setup.py/python_publicsuffix_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/python_publicsuffix_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) +test_envt = PackageTester() - def test_parse_setup_py_repology_py_libversion(self): - test_file = self.get_test_loc('pypi/setup.py/repology_py_libversion_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/repology_py_libversion_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_saneyaml(self): - test_file = self.get_test_loc('pypi/setup.py/saneyaml_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/saneyaml_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) +@pytest.mark.parametrize( + 'test_loc', + get_setup_py_test_files(os.path.abspath(os.path.join(test_envt.test_data_dir, 'pypi', 'setup.py-versions'))), +) +def test_parse_setup_py_with_computed_versions(test_loc): + check_setup_py_parsing(test_loc) - def test_parse_setup_py_setuppycheck(self): - test_file = self.get_test_loc('pypi/setup.py/setuppycheck_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/setuppycheck_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_url_py(self): - test_file = self.get_test_loc('pypi/setup.py/url_py_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/url_py_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) +@pytest.mark.parametrize( + 'test_loc', + get_setup_py_test_files(os.path.abspath(os.path.join(test_envt.test_data_dir, 'pypi', 'setup.py'))) +) +def test_parse_setup_py(test_loc): + check_setup_py_parsing(test_loc) - def test_parse_setup_py_venv(self): - test_file = self.get_test_loc('pypi/setup.py/venv_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/venv_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) - def test_parse_setup_py_xmltodict(self): - test_file = self.get_test_loc('pypi/setup.py/xmltodict_setup.py') - package = pypi.PythonSetupPyHandler.parse(test_file) - expected_loc = self.get_test_loc('pypi/setup.py/xmltodict_setup.py-expected.json') - self.check_packages_data(package, expected_loc, regen=REGEN_TEST_FIXTURES) +@pytest.mark.parametrize( + 'test_loc', + get_setup_py_test_files(os.path.abspath(os.path.join(test_envt.test_data_dir, 'pypi', 'more_setup.py'))), +) +def test_parse_more_setup_py(test_loc): + check_setup_py_parsing(test_loc) diff --git a/tests/summarycode/data/summary/use_holder_from_package_resource/use_holder_from_package_resource.expected.json b/tests/summarycode/data/summary/use_holder_from_package_resource/use_holder_from_package_resource.expected.json index 3f4b46cc57c..7a9d1b31f28 100644 --- a/tests/summarycode/data/summary/use_holder_from_package_resource/use_holder_from_package_resource.expected.json +++ b/tests/summarycode/data/summary/use_holder_from_package_resource/use_holder_from_package_resource.expected.json @@ -2,7 +2,7 @@ "dependencies": [ { "purl": "pkg:pypi/pybind11", - "extracted_requirement": ">=2.5.0", + "extracted_requirement": "pybind11>=2.5.0", "scope": "setup", "is_runtime": true, "is_optional": false, @@ -30,7 +30,7 @@ "type": "person", "role": "author", "name": "Bitshift", - "email": null, + "email": "atheris@google.com", "url": null } ], @@ -279,7 +279,7 @@ "type": "person", "role": "author", "name": "Bitshift", - "email": null, + "email": "atheris@google.com", "url": null } ], @@ -304,7 +304,7 @@ "dependencies": [ { "purl": "pkg:pypi/pybind11", - "extracted_requirement": ">=2.5.0", + "extracted_requirement": "pybind11>=2.5.0", "scope": "setup", "is_runtime": true, "is_optional": false,