Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nxd-bom
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
nxd-bom
Commits
13791679
Commit
13791679
authored
Jun 12, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a3a05334
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
nxdbom/__init__.py
nxdbom/__init__.py
+10
-7
No files found.
nxdbom/__init__.py
View file @
13791679
...
@@ -36,6 +36,7 @@ from glob import glob
...
@@ -36,6 +36,7 @@ from glob import glob
from
collections
import
namedtuple
from
collections
import
namedtuple
from
urllib.parse
import
unquote
from
urllib.parse
import
unquote
import
email.parser
import
email.parser
import
zipfile
# PkgInfo represents information about a package
# PkgInfo represents information about a package
...
@@ -86,14 +87,16 @@ def bom_software(installed_software_path): # -> {} (name,kind) -> PkgInfo
...
@@ -86,14 +87,16 @@ def bom_software(installed_software_path): # -> {} (name,kind) -> PkgInfo
url
=
'https://pypi.org/project/%s/%s/'
%
(
name
,
v
)
url
=
'https://pypi.org/project/%s/%s/'
%
(
name
,
v
)
if
isdir
(
urlpath
):
if
isdir
(
urlpath
):
with
open
(
'%s/EGG-INFO/PKG-INFO'
%
urlpath
)
as
f
:
with
open
(
'%s/EGG-INFO/PKG-INFO'
%
urlpath
,
'rb'
)
as
f
:
p
=
email
.
parser
.
Parser
()
pkginfo
=
f
.
read
()
meta
=
p
.
parse
(
f
,
headersonly
=
True
)
license
=
meta
[
'license'
]
else
:
else
:
# TODO unzip (e.g. setuptools)
# unzip (e.g. setuptools)
pass
with
zipfile
.
ZipFile
(
urlpath
,
'r'
)
as
z
:
with
z
.
open
(
'EGG-INFO/PKG-INFO'
)
as
f
:
pkginfo
=
f
.
read
()
p
=
email
.
parser
.
BytesParser
()
meta
=
p
.
parsebytes
(
pkginfo
,
headersonly
=
True
)
license
=
meta
[
'license'
]
else
:
else
:
raise
NotImplementedError
(
'TODO url for kind %r (urlpath: %r)'
%
(
kind
,
urlpath
))
raise
NotImplementedError
(
'TODO url for kind %r (urlpath: %r)'
%
(
kind
,
urlpath
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment