Skip to content

Commit

Permalink
Move to src layout; remove scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Henri Rosten <[email protected]>
  • Loading branch information
henrirosten committed Nov 28, 2023
1 parent b2a6739 commit 56a65e4
Show file tree
Hide file tree
Showing 27 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion nix/devshell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# (cascading down to the processes it spawns), but this is for the developer
# invoking entrypoints from inside the devshell.
shellHook = ''
export PYTHONPATH="$PYTHONPATH:$(pwd)"
export PYTHONPATH="$PYTHONPATH:$(pwd)/src"
'';
};
};
Expand Down
18 changes: 6 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,16 @@ def project_path(*names):
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
],
keywords="SBOM",
packages=[
"sbomnix",
"nixgraph",
"scripts.vulnxscan",
"scripts.nixupdate",
"scripts.repology",
],
packages=setuptools.find_namespace_packages(where="src"),
package_dir={"": "src"},
entry_points={
"console_scripts": [
"sbomnix = sbomnix.main:main",
"nixgraph = nixgraph.main:main",
"nix_outdated = scripts.nixupdate.nix_outdated:main",
"vulnxscan = scripts.vulnxscan.vulnxscan:main",
"repology_cli = scripts.repology.repology_cli:main",
"repology_cve = scripts.repology.repology_cve:main",
"nix_outdated = nixupdate.nix_outdated:main",
"vulnxscan = vulnxscan.vulnxscan_cli:main",
"repology_cli = repology.repology_cli:main",
"repology_cve = repology.repology_cve:main",
]
},
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion nixgraph/graph.py → src/nixgraph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import pandas as pd
import graphviz as gv

from sbomnix.utils import (
from common.utils import (
LOG,
LOG_SPAM,
exec_cmd,
Expand Down
2 changes: 1 addition & 1 deletion nixgraph/main.py → src/nixgraph/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import argparse
import pathlib
from nixgraph.graph import NixDependencies
from sbomnix.utils import (
from common.utils import (
set_log_verbosity,
get_py_pkg_version,
check_positive,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from argparse import ArgumentParser
from tabulate import tabulate
from sbomnix.sbomdb import SbomDb
from sbomnix.utils import (
from common.utils import (
LOG,
LOG_SPAM,
set_log_verbosity,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import numpy as np
import pandas as pd
from tabulate import tabulate
from sbomnix.utils import (
from common.utils import (
LOG,
LOG_SPAM,
set_log_verbosity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import numpy as np
import pandas as pd
from tabulate import tabulate
from sbomnix.utils import (
from common.utils import (
LOG,
LOG_SPAM,
set_log_verbosity,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sbomnix/cpe.py → src/sbomnix/cpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import shutil
import requests

from sbomnix.utils import (
from common.utils import (
LOG,
LOG_SPAM,
df_from_csv_file,
Expand Down
2 changes: 1 addition & 1 deletion sbomnix/derivation.py → src/sbomnix/derivation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from packageurl import PackageURL
from sbomnix.cpe import CPE

from sbomnix.utils import LOG, LOG_SPAM
from common.utils import LOG, LOG_SPAM


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion sbomnix/main.py → src/sbomnix/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import argparse
import pathlib
from sbomnix.sbomdb import SbomDb
from sbomnix.utils import (
from common.utils import (
LOG,
set_log_verbosity,
check_positive,
Expand Down
2 changes: 1 addition & 1 deletion sbomnix/nix.py → src/sbomnix/nix.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import json
import pandas as pd

from sbomnix.utils import LOG, LOG_SPAM, exec_cmd
from common.utils import LOG, LOG_SPAM, exec_cmd
from sbomnix.derivation import load

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion sbomnix/sbomdb.py → src/sbomnix/sbomdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from reuse._licenses import LICENSE_MAP as SPDX_LICENSES
from nixgraph.graph import NixDependencies
from sbomnix.nix import Store, find_deriver
from sbomnix.utils import LOG, df_to_csv_file, get_py_pkg_version
from common.utils import LOG, df_to_csv_file, get_py_pkg_version

###############################################################################

Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions src/vulnxscan/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2022 Technology Innovation Institute (TII)
#
# SPDX-License-Identifier: Apache-2.0
2 changes: 1 addition & 1 deletion scripts/vulnxscan/osv.py → src/vulnxscan/osv.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import json
import requests
import pandas as pd
from sbomnix.utils import LOG, LOG_SPAM, df_to_csv_file, set_log_verbosity
from common.utils import LOG, LOG_SPAM, df_to_csv_file, set_log_verbosity

###############################################################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import numpy as np

from tabulate import tabulate
from scripts.vulnxscan.osv import OSV
from vulnxscan.osv import OSV
from sbomnix.sbomdb import SbomDb
from sbomnix.utils import (
from common.utils import (
LOG,
LOG_SPAM,
set_log_verbosity,
Expand Down
2 changes: 1 addition & 1 deletion tests/compare_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import pathlib
import json
import pandas as pd
from sbomnix.utils import (
from common.utils import (
LOG,
LOG_SPAM,
set_log_verbosity,
Expand Down
2 changes: 1 addition & 1 deletion tests/compare_sboms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import pathlib
import json
import pandas as pd
from sbomnix.utils import LOG, df_to_csv_file, set_log_verbosity
from common.utils import LOG, df_to_csv_file, set_log_verbosity

###############################################################################

Expand Down
17 changes: 9 additions & 8 deletions tests/test_sbomnix.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import jsonschema
import pytest

from sbomnix.utils import (
from common.utils import (
df_from_csv_file,
)

from scripts.vulnxscan.vulnxscan import (
from vulnxscan.vulnxscan_cli import (
load_whitelist,
df_apply_whitelist,
)
Expand All @@ -35,16 +35,17 @@
COMPARE_SBOMS = MYDIR / "compare_sboms.py"

REPOROOT = MYDIR / ".."
SRCDIR = REPOROOT / "src"

# The different entrypoints of the application. Currently we invoke them with a
# new python interpreter, as it's not in a shape yet to import a function we
# pass arguments to.
SBOMNIX = REPOROOT / "sbomnix" / "main.py"
NIXGRAPH = REPOROOT / "nixgraph" / "main.py"
NIX_OUTDATED = REPOROOT / "scripts" / "nixupdate" / "nix_outdated.py"
VULNXSCAN = REPOROOT / "scripts" / "vulnxscan" / "vulnxscan.py"
REPOLOGY_CLI = REPOROOT / "scripts" / "repology" / "repology_cli.py"
REPOLOGY_CVE = REPOROOT / "scripts" / "repology" / "repology_cve.py"
SBOMNIX = SRCDIR / "sbomnix" / "main.py"
NIXGRAPH = SRCDIR / "nixgraph" / "main.py"
NIX_OUTDATED = SRCDIR / "nixupdate" / "nix_outdated.py"
VULNXSCAN = SRCDIR / "vulnxscan" / "vulnxscan_cli.py"
REPOLOGY_CLI = SRCDIR / "repology" / "repology_cli.py"
REPOLOGY_CVE = SRCDIR / "repology" / "repology_cve.py"

TEST_WORK_DIR = None
TEST_NIX_RESULT = None
Expand Down

0 comments on commit 56a65e4

Please sign in to comment.