Skip to content

Commit ea6cd6d

Browse files
committed
Skip site-packages directory
Signed-off-by: Jono Yang <[email protected]>
1 parent 54207c1 commit ea6cd6d

File tree

14 files changed

+1176
-6
lines changed

14 files changed

+1176
-6
lines changed

src/packagedcode/npm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def assemble(cls, package_data, resource, codebase):
8989
if not package.license_expression:
9090
package.license_expression = compute_normalized_license(package.declared_license)
9191

92-
root = resource.parent(codebase)
92+
root = package_resource.parent(codebase)
9393
if root:
9494
for npm_res in cls.walk_npm(resource=root, codebase=codebase):
9595
if package_uid not in npm_res.for_packages:

src/packagedcode/pypi.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ def assemble(cls, package_data, resource, codebase):
207207

208208
root = package_resource.parent(codebase)
209209
if root:
210-
# TODO: skip site-package directory
211-
for py_res in root.walk(codebase):
210+
for py_res in cls.walk_pypi(resource=root, codebase=codebase):
212211
if py_res.is_dir:
213212
continue
214213
if package_uid not in py_res.for_packages:
@@ -237,6 +236,26 @@ def assemble(cls, package_data, resource, codebase):
237236
sibling.save(codebase)
238237
yield sibling
239238

239+
@classmethod
240+
def walk_pypi(cls, resource, codebase):
241+
"""
242+
Walk the ``codebase`` Codebase top-down, breadth-first starting from the
243+
``resource`` Resource.
244+
245+
Skip the directory named "site-packages": this avoids
246+
reporting nested vendored packages as being part of their parent.
247+
Instead they will be reported on their own.
248+
"""
249+
for child in resource.children(codebase):
250+
if child.name == 'site-packages':
251+
continue
252+
253+
yield child
254+
255+
if child.is_dir:
256+
for subchild in cls.walk_pypi(child, codebase):
257+
yield subchild
258+
240259

241260
class PythonSdistPkgInfoFile(BaseExtractedPythonLayout):
242261
datasource_id = 'pypi_sdist_pkginfo'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Metadata-Version: 1.0
2+
Name: PyJPString
3+
Version: 0.0.3
4+
Summary: Python japanese string utilities.
5+
Home-page: http://github.com/odoku/PyJPString
6+
Author: odoku
7+
Author-email: [email protected]
8+
License: MIT
9+
Description: UNKNOWN
10+
Keywords: japanese,string
11+
Platform: UNKNOWN
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pip
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright 2014 Pallets
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
1. Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
14+
3. Neither the name of the copyright holder nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
Metadata-Version: 2.1
2+
Name: click
3+
Version: 8.0.4
4+
Summary: Composable command line interface toolkit
5+
Home-page: https://palletsprojects.com/p/click/
6+
Author: Armin Ronacher
7+
Author-email: [email protected]
8+
Maintainer: Pallets
9+
Maintainer-email: [email protected]
10+
License: BSD-3-Clause
11+
Project-URL: Donate, https://palletsprojects.com/donate
12+
Project-URL: Documentation, https://click.palletsprojects.com/
13+
Project-URL: Changes, https://click.palletsprojects.com/changes/
14+
Project-URL: Source Code, https://github.com/pallets/click/
15+
Project-URL: Issue Tracker, https://github.com/pallets/click/issues/
16+
Project-URL: Twitter, https://twitter.com/PalletsTeam
17+
Project-URL: Chat, https://discord.gg/pallets
18+
Platform: UNKNOWN
19+
Classifier: Development Status :: 5 - Production/Stable
20+
Classifier: Intended Audience :: Developers
21+
Classifier: License :: OSI Approved :: BSD License
22+
Classifier: Operating System :: OS Independent
23+
Classifier: Programming Language :: Python
24+
Requires-Python: >=3.6
25+
Description-Content-Type: text/x-rst
26+
License-File: LICENSE.rst
27+
Requires-Dist: colorama ; platform_system == "Windows"
28+
Requires-Dist: importlib-metadata ; python_version < "3.8"
29+
30+
\$ click\_
31+
==========
32+
33+
Click is a Python package for creating beautiful command line interfaces
34+
in a composable way with as little code as necessary. It's the "Command
35+
Line Interface Creation Kit". It's highly configurable but comes with
36+
sensible defaults out of the box.
37+
38+
It aims to make the process of writing command line tools quick and fun
39+
while also preventing any frustration caused by the inability to
40+
implement an intended CLI API.
41+
42+
Click in three points:
43+
44+
- Arbitrary nesting of commands
45+
- Automatic help page generation
46+
- Supports lazy loading of subcommands at runtime
47+
48+
49+
Installing
50+
----------
51+
52+
Install and update using `pip`_:
53+
54+
.. code-block:: text
55+
56+
$ pip install -U click
57+
58+
.. _pip: https://pip.pypa.io/en/stable/getting-started/
59+
60+
61+
A Simple Example
62+
----------------
63+
64+
.. code-block:: python
65+
66+
import click
67+
68+
@click.command()
69+
@click.option("--count", default=1, help="Number of greetings.")
70+
@click.option("--name", prompt="Your name", help="The person to greet.")
71+
def hello(count, name):
72+
"""Simple program that greets NAME for a total of COUNT times."""
73+
for _ in range(count):
74+
click.echo(f"Hello, {name}!")
75+
76+
if __name__ == '__main__':
77+
hello()
78+
79+
.. code-block:: text
80+
81+
$ python hello.py --count=3
82+
Your name: Click
83+
Hello, Click!
84+
Hello, Click!
85+
Hello, Click!
86+
87+
88+
Donate
89+
------
90+
91+
The Pallets organization develops and supports Click and other popular
92+
packages. In order to grow the community of contributors and users, and
93+
allow the maintainers to devote more time to the projects, `please
94+
donate today`_.
95+
96+
.. _please donate today: https://palletsprojects.com/donate
97+
98+
99+
Links
100+
-----
101+
102+
- Documentation: https://click.palletsprojects.com/
103+
- Changes: https://click.palletsprojects.com/changes/
104+
- PyPI Releases: https://pypi.org/project/click/
105+
- Source Code: https://github.com/pallets/click
106+
- Issue Tracker: https://github.com/pallets/click/issues
107+
- Website: https://palletsprojects.com/p/click
108+
- Twitter: https://twitter.com/PalletsTeam
109+
- Chat: https://discord.gg/pallets
110+
111+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
click-8.0.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2+
click-8.0.4.dist-info/LICENSE.rst,sha256=morRBqOU6FO_4h9C9OctWSgZoigF2ZG18ydQKSkrZY0,1475
3+
click-8.0.4.dist-info/METADATA,sha256=zcuHOwCuWGOxyQO9MNOlHVHnEqfFAUi2lHHEpCMtLJw,3247
4+
click-8.0.4.dist-info/RECORD,,
5+
click-8.0.4.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
6+
click-8.0.4.dist-info/top_level.txt,sha256=J1ZQogalYS4pphY_lPECoNMfw0HzTSrZglC4Yfwo4xA,6
7+
click/__init__.py,sha256=bOKrvMqmR9rN07vN_ycyrdF-EcTCl-EmuAjq-Fp4yPM,3243
8+
click/__pycache__/__init__.cpython-36.pyc,,
9+
click/__pycache__/_compat.cpython-36.pyc,,
10+
click/__pycache__/_termui_impl.cpython-36.pyc,,
11+
click/__pycache__/_textwrap.cpython-36.pyc,,
12+
click/__pycache__/_unicodefun.cpython-36.pyc,,
13+
click/__pycache__/_winconsole.cpython-36.pyc,,
14+
click/__pycache__/core.cpython-36.pyc,,
15+
click/__pycache__/decorators.cpython-36.pyc,,
16+
click/__pycache__/exceptions.cpython-36.pyc,,
17+
click/__pycache__/formatting.cpython-36.pyc,,
18+
click/__pycache__/globals.cpython-36.pyc,,
19+
click/__pycache__/parser.cpython-36.pyc,,
20+
click/__pycache__/shell_completion.cpython-36.pyc,,
21+
click/__pycache__/termui.cpython-36.pyc,,
22+
click/__pycache__/testing.cpython-36.pyc,,
23+
click/__pycache__/types.cpython-36.pyc,,
24+
click/__pycache__/utils.cpython-36.pyc,,
25+
click/_compat.py,sha256=JIHLYs7Jzz4KT9t-ds4o4jBzLjnwCiJQKqur-5iwCKI,18810
26+
click/_termui_impl.py,sha256=qK6Cfy4mRFxvxE8dya8RBhLpSC8HjF-lvBc6aNrPdwg,23451
27+
click/_textwrap.py,sha256=10fQ64OcBUMuK7mFvh8363_uoOxPlRItZBmKzRJDgoY,1353
28+
click/_unicodefun.py,sha256=JKSh1oSwG_zbjAu4TBCa9tQde2P9FiYcf4MBfy5NdT8,3201
29+
click/_winconsole.py,sha256=5ju3jQkcZD0W27WEMGqmEP4y_crUVzPCqsX_FYb7BO0,7860
30+
click/core.py,sha256=MYYmvqVa_dh4x4f-mr7VyNi6197ucYbJ0fsWW5EnCrA,111432
31+
click/decorators.py,sha256=5ZngOD72Flo8VLN29iarI0A5u_F-dxmqtUqx4KN8hOg,14879
32+
click/exceptions.py,sha256=7gDaLGuFZBeCNwY9ERMsF2-Z3R9Fvq09Zc6IZSKjseo,9167
33+
click/formatting.py,sha256=Frf0-5W33-loyY_i9qrwXR8-STnW3m5gvyxLVUdyxyk,9706
34+
click/globals.py,sha256=TP-qM88STzc7f127h35TD_v920FgfOD2EwzqA0oE8XU,1961
35+
click/parser.py,sha256=cAEt1uQR8gq3-S9ysqbVU-fdAZNvilxw4ReJ_T1OQMk,19044
36+
click/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37+
click/shell_completion.py,sha256=HHH0wMwlDW4WQhs8rRcS9M8MAo9gltGBN6V2PEbsTp0,18003
38+
click/termui.py,sha256=mZ12uc3-loFaV__vr8buxn9uIjAhy7QwVuZOQ8jDdjc,28873
39+
click/testing.py,sha256=ptpMYgRY7dVfE3UDgkgwayu9ePw98sQI3D7zZXiCpj4,16063
40+
click/types.py,sha256=rj2g3biAXKkNKV8vlwbIKSUlixhXybH84N84fwCYqUU,35092
41+
click/utils.py,sha256=M8tuplcFFHROha3vQ60ZRSakSB_ng6w9e8Uc1AugPZ0,18934
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Wheel-Version: 1.0
2+
Generator: bdist_wheel (0.37.1)
3+
Root-Is-Purelib: true
4+
Tag: py3-none-any
5+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
click

tests/packagedcode/data/pypi/site-packages/codebase/lib/python3.9/site-packages/click/core.py

Whitespace-only changes.

0 commit comments

Comments
 (0)