ossa-scanner 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. ossa_scanner-0.1.1/PKG-INFO +28 -0
  2. ossa_scanner-0.1.1/ossa_scanner/__init__.py +1 -0
  3. ossa_scanner-0.1.1/ossa_scanner/cli.py +35 -0
  4. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/ossa_scanner/scanner.py +6 -12
  5. ossa_scanner-0.1.1/ossa_scanner/utils/os_detection.py +13 -0
  6. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/ossa_scanner/utils/package_manager.py +6 -0
  7. ossa_scanner-0.1.1/ossa_scanner/utils/swhid_calculator.py +3 -0
  8. ossa_scanner-0.1.1/ossa_scanner.egg-info/PKG-INFO +28 -0
  9. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/ossa_scanner.egg-info/SOURCES.txt +3 -2
  10. ossa_scanner-0.1.1/ossa_scanner.egg-info/entry_points.txt +2 -0
  11. ossa_scanner-0.1.1/ossa_scanner.egg-info/requires.txt +3 -0
  12. ossa_scanner-0.1.1/setup.cfg +4 -0
  13. ossa_scanner-0.1.1/setup.py +55 -0
  14. ossa_scanner-0.1.0/PKG-INFO +0 -41
  15. ossa_scanner-0.1.0/ossa_scanner/utils/__init__.py +0 -0
  16. ossa_scanner-0.1.0/ossa_scanner/utils/os_detection.py +0 -10
  17. ossa_scanner-0.1.0/ossa_scanner/utils/swhid_calculator.py +0 -4
  18. ossa_scanner-0.1.0/ossa_scanner.egg-info/PKG-INFO +0 -41
  19. ossa_scanner-0.1.0/ossa_scanner.egg-info/requires.txt +0 -1
  20. ossa_scanner-0.1.0/pyproject.toml +0 -28
  21. ossa_scanner-0.1.0/setup.cfg +0 -31
  22. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/LICENSE +0 -0
  23. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/README.md +0 -0
  24. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/ossa_scanner/uploader.py +0 -0
  25. {ossa_scanner-0.1.0/ossa_scanner → ossa_scanner-0.1.1/ossa_scanner/utils}/__init__.py +0 -0
  26. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/ossa_scanner/utils/downloader.py +0 -0
  27. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/ossa_scanner/utils/hash_calculator.py +0 -0
  28. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/ossa_scanner.egg-info/dependency_links.txt +0 -0
  29. {ossa_scanner-0.1.0 → ossa_scanner-0.1.1}/ossa_scanner.egg-info/top_level.txt +0 -0
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: ossa_scanner
3
+ Version: 0.1.1
4
+ Summary: A Python library for scanning Linux packages, managing metadata, and generating SWHIDs.
5
+ Home-page: https://github.com/oscarvalenzuelab/ossa_scanner
6
+ Author: Oscar Valenzuela
7
+ Author-email: oscar.valenzuela.b@gmail.com
8
+ License: MIT
9
+ Keywords: linux packages SWHID open-source compliance
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.6
15
+ Classifier: Programming Language :: Python :: 3.7
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Requires-Python: >=3.6
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: click
24
+ Requires-Dist: swh.model
25
+ Requires-Dist: distro
26
+
27
+ # ossa_scanner
28
+ Open Source Advisory Scanner (Generator)
@@ -0,0 +1 @@
1
+ __version__ = "0.1.1"
@@ -0,0 +1,35 @@
1
+ import argparse
2
+ from .scanner import Scanner
3
+ from .uploader import GitHubUploader
4
+
5
+ def main():
6
+ parser = argparse.ArgumentParser(description="OSSA Scanner CLI Tool")
7
+ parser.add_argument('--output-dir', type=str, required=True, help="Directory to save downloaded source")
8
+ parser.add_argument('--results-file', type=str, required=True, help="Path to save the JSON results")
9
+ parser.add_argument('--threads', type=int, default=4, help="Number of threads for parallel processing")
10
+ parser.add_argument('--upload', action='store_true', help="Upload results to GitHub")
11
+ parser.add_argument('--repo-owner', type=str, help="GitHub repository owner")
12
+ parser.add_argument('--repo-name', type=str, help="GitHub repository name")
13
+ parser.add_argument('--token', type=str, help="GitHub token")
14
+ parser.add_argument('--repo-dir', type=str, help="Target directory in GitHub repo for results")
15
+ args = parser.parse_args()
16
+
17
+ # Initialize the scanner
18
+ scanner = Scanner(output_dir=args.output_dir, threads=args.threads)
19
+
20
+ # Perform scanning
21
+ results = scanner.scan_packages()
22
+
23
+ # Save results locally
24
+ scanner.save_results(results, args.results_file)
25
+
26
+ # Upload results to GitHub if specified
27
+ if args.upload:
28
+ if not (args.repo_owner and args.repo_name and args.token and args.repo_dir):
29
+ raise ValueError("GitHub upload requires --repo-owner, --repo-name, --token, and --repo-dir")
30
+
31
+ uploader = GitHubUploader(args.token, args.repo_owner, args.repo_name)
32
+ scanner.upload_results(args.results_file, uploader, args.repo_dir)
33
+
34
+ if __name__ == "__main__":
35
+ main()
@@ -1,21 +1,15 @@
1
1
  import os
2
2
  import json
3
3
  from concurrent.futures import ThreadPoolExecutor, as_completed
4
- from ossa_scanner.utils.os_detection import detect_os
5
- from ossa_scanner.utils.package_manager import list_packages, get_package_info, download_source
6
- from ossa_scanner.utils.hash_calculator import calculate_file_hash
7
- from ossa_scanner.utils.swhid_calculator import calculate_swhid
8
- from ossa_scanner.uploader import GitHubUploader
4
+ from .utils.os_detection import detect_os
5
+ from .utils.package_manager import list_packages, get_package_info
6
+ from .utils.downloader import download_source
7
+ from .utils.hash_calculator import calculate_file_hash
8
+ from .utils.swhid_calculator import calculate_swhid
9
+ from .uploader import GitHubUploader
9
10
 
10
11
  class Scanner:
11
12
  def __init__(self, output_dir, threads=4):
12
- """
13
- Initialize the scanner with the output directory and thread count.
14
-
15
- Args:
16
- output_dir (str): Directory to store downloaded files and extracted sources.
17
- threads (int): Number of threads for parallel processing.
18
- """
19
13
  self.output_dir = output_dir
20
14
  self.os_type = detect_os()
21
15
  self.threads = threads
@@ -0,0 +1,13 @@
1
+ import distro
2
+
3
+ def detect_os():
4
+ dist = distro.id()
5
+ if 'ubuntu' in dist or 'debian' in dist:
6
+ return 'apt'
7
+ elif 'redhat' in dist or 'centos' in dist or 'almalinux' in dist:
8
+ return 'yum'
9
+ elif 'darwin' in dist:
10
+ return 'brew'
11
+ else:
12
+ raise ValueError("Unsupported OS")
13
+
@@ -13,6 +13,12 @@ def list_packages(package_manager):
13
13
  capture_output=True,
14
14
  text=True
15
15
  )
16
+ elif package_manager == 'brew':
17
+ result = subprocess.run(
18
+ ['brew', 'search', '.'],
19
+ capture_output=True,
20
+ text=True
21
+ )
16
22
  else:
17
23
  raise ValueError("Unsupported package manager")
18
24
 
@@ -0,0 +1,3 @@
1
+
2
+ def calculate_swhid(directory_path):
3
+ return directory_path
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: ossa_scanner
3
+ Version: 0.1.1
4
+ Summary: A Python library for scanning Linux packages, managing metadata, and generating SWHIDs.
5
+ Home-page: https://github.com/oscarvalenzuelab/ossa_scanner
6
+ Author: Oscar Valenzuela
7
+ Author-email: oscar.valenzuela.b@gmail.com
8
+ License: MIT
9
+ Keywords: linux packages SWHID open-source compliance
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.6
15
+ Classifier: Programming Language :: Python :: 3.7
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Requires-Python: >=3.6
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: click
24
+ Requires-Dist: swh.model
25
+ Requires-Dist: distro
26
+
27
+ # ossa_scanner
28
+ Open Source Advisory Scanner (Generator)
@@ -1,13 +1,14 @@
1
1
  LICENSE
2
2
  README.md
3
- pyproject.toml
4
- setup.cfg
3
+ setup.py
5
4
  ossa_scanner/__init__.py
5
+ ossa_scanner/cli.py
6
6
  ossa_scanner/scanner.py
7
7
  ossa_scanner/uploader.py
8
8
  ossa_scanner.egg-info/PKG-INFO
9
9
  ossa_scanner.egg-info/SOURCES.txt
10
10
  ossa_scanner.egg-info/dependency_links.txt
11
+ ossa_scanner.egg-info/entry_points.txt
11
12
  ossa_scanner.egg-info/requires.txt
12
13
  ossa_scanner.egg-info/top_level.txt
13
14
  ossa_scanner/utils/__init__.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ossa_scanner = ossa_scanner.cli:main
@@ -0,0 +1,3 @@
1
+ click
2
+ swh.model
3
+ distro
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,55 @@
1
+ from setuptools import setup, find_packages
2
+ import os
3
+
4
+ def get_version():
5
+ """
6
+ Extract the version from __init__.py.
7
+ """
8
+ version_file = os.path.join(os.path.dirname(__file__), "ossa_scanner", "__init__.py")
9
+ with open(version_file, "r") as f:
10
+ for line in f:
11
+ if line.startswith("__version__"):
12
+ delim = '"' if '"' in line else "'"
13
+ return line.split(delim)[1]
14
+ raise RuntimeError("Version not found in __init__.py")
15
+
16
+ # Read the README file for the long description
17
+ with open("README.md", "r", encoding="utf-8") as fh:
18
+ long_description = fh.read()
19
+
20
+ setup(
21
+ name="ossa_scanner",
22
+ version=get_version(),
23
+ description="A Python library for scanning Linux packages, managing metadata, and generating SWHIDs.",
24
+ long_description=long_description,
25
+ long_description_content_type='text/markdown',
26
+ author="Oscar Valenzuela",
27
+ author_email="oscar.valenzuela.b@gmail.com",
28
+ license='MIT',
29
+ url='https://github.com/oscarvalenzuelab/ossa_scanner',
30
+ packages=find_packages(),
31
+ install_requires=[
32
+ "click",
33
+ "swh.model",
34
+ "distro",
35
+ ],
36
+ entry_points={
37
+ "console_scripts": [
38
+ "ossa_scanner=ossa_scanner.cli:main",
39
+ ],
40
+ },
41
+ python_requires='>=3.6',
42
+ classifiers=[
43
+ "Development Status :: 3 - Alpha",
44
+ "Intended Audience :: Developers",
45
+ "License :: OSI Approved :: MIT License",
46
+ "Programming Language :: Python :: 3",
47
+ "Programming Language :: Python :: 3.6",
48
+ "Programming Language :: Python :: 3.7",
49
+ "Programming Language :: Python :: 3.8",
50
+ "Programming Language :: Python :: 3.9",
51
+ "Programming Language :: Python :: 3.10",
52
+ "Operating System :: POSIX :: Linux",
53
+ ],
54
+ keywords="linux packages SWHID open-source compliance",
55
+ )
@@ -1,41 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: ossa-scanner
3
- Version: 0.1.0
4
- Summary: A CLI tool to scan Linux packages, manage metadata, and upload results to GitHub.
5
- Author: Oscar Valenzuela
6
- Author-email: Oscar Valenzuela <oscar.valenzuela.b@gmail.com>
7
- License: MIT License
8
-
9
- Copyright (c) 2024 Oscar V
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
28
-
29
- Keywords: linux,packages,SWHID,GitHub,open-source
30
- Classifier: Development Status :: 3 - Alpha
31
- Classifier: Intended Audience :: Developers
32
- Classifier: License :: OSI Approved :: MIT License
33
- Classifier: Programming Language :: Python :: 3
34
- Classifier: Operating System :: POSIX :: Linux
35
- Requires-Python: >=3.7
36
- Description-Content-Type: text/markdown
37
- License-File: LICENSE
38
- Requires-Dist: swh.model
39
-
40
- # ossa_scanner
41
- Open Source Advisory Scanner (Generator)
File without changes
@@ -1,10 +0,0 @@
1
- import platform
2
-
3
- def detect_os():
4
- dist, _, _ = platform.linux_distribution(full_distribution_name=False)
5
- if 'Ubuntu' in dist or 'Debian' in dist:
6
- return 'apt'
7
- elif 'Red Hat' in dist or 'CentOS' in dist or 'AlmaLinux' in dist:
8
- return 'yum'
9
- else:
10
- raise ValueError("Unsupported OS")
@@ -1,4 +0,0 @@
1
- from swh.model.hashutil import hash_directory
2
-
3
- def calculate_swhid(directory_path):
4
- return hash_directory(directory_path)
@@ -1,41 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: ossa-scanner
3
- Version: 0.1.0
4
- Summary: A CLI tool to scan Linux packages, manage metadata, and upload results to GitHub.
5
- Author: Oscar Valenzuela
6
- Author-email: Oscar Valenzuela <oscar.valenzuela.b@gmail.com>
7
- License: MIT License
8
-
9
- Copyright (c) 2024 Oscar V
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
28
-
29
- Keywords: linux,packages,SWHID,GitHub,open-source
30
- Classifier: Development Status :: 3 - Alpha
31
- Classifier: Intended Audience :: Developers
32
- Classifier: License :: OSI Approved :: MIT License
33
- Classifier: Programming Language :: Python :: 3
34
- Classifier: Operating System :: POSIX :: Linux
35
- Requires-Python: >=3.7
36
- Description-Content-Type: text/markdown
37
- License-File: LICENSE
38
- Requires-Dist: swh.model
39
-
40
- # ossa_scanner
41
- Open Source Advisory Scanner (Generator)
@@ -1 +0,0 @@
1
- swh.model
@@ -1,28 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools", "wheel"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "ossa-scanner"
7
- version = "0.1.0"
8
- description = "A CLI tool to scan Linux packages, manage metadata, and upload results to GitHub."
9
- readme = "README.md"
10
- requires-python = ">=3.7"
11
- license = { file = "LICENSE" }
12
- authors = [
13
- { name = "Oscar Valenzuela", email = "oscar.valenzuela.b@gmail.com" }
14
- ]
15
- classifiers = [
16
- "Development Status :: 3 - Alpha",
17
- "Intended Audience :: Developers",
18
- "License :: OSI Approved :: MIT License",
19
- "Programming Language :: Python :: 3",
20
- "Operating System :: POSIX :: Linux",
21
- ]
22
- keywords = ["linux", "packages", "SWHID", "GitHub", "open-source"]
23
- dependencies = [
24
- "swh.model",
25
- ]
26
-
27
- [project.entry-points.console_scripts]
28
- ossa-scanner = "cli:main"
@@ -1,31 +0,0 @@
1
- [metadata]
2
- name = ossa-scanner
3
- version = 0.1.0
4
- description = Open Source Advisory Generator
5
- long_description = file: README.md
6
- long_description_content_type = text/markdown
7
- author = Oscar Valenzuela
8
- author_email = oscar.valenzuela.b@gmail.com
9
- license = MIT
10
- classifiers =
11
- Development Status :: 3 - Alpha
12
- Intended Audience :: Developers
13
- License :: OSI Approved :: MIT License
14
- Programming Language :: Python :: 3
15
- Operating System :: POSIX :: Linux
16
- keywords = linux, packages, SWHID, open-source
17
-
18
- [options]
19
- packages = find:
20
- python_requires = >=3.7
21
- install_requires =
22
- swh.model
23
-
24
- [options.entry_points]
25
- console_scripts =
26
- ossa-scanner = cli:main
27
-
28
- [egg_info]
29
- tag_build =
30
- tag_date = 0
31
-
File without changes
File without changes