Skip to content

Commit eed9dd4

Browse files
committed
Remove unused code in python_gardenlinux_lib module
Signed-off-by: Tobias Wolf <[email protected]>
1 parent 377e95a commit eed9dd4

File tree

9 files changed

+15
-288
lines changed

9 files changed

+15
-288
lines changed

src/gardenlinux/apt/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from .debsource import Debsrc, DebsrcFile
4+
5+
__all__ = ["Parser"]
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from .git import Git
21
from .version import Version
32

4-
__all__ = ["Git", "Version"]
3+
__all__ = ["Version"]

src/python_gardenlinux_lib/features/parse_features.py

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -36,53 +36,6 @@ def get_gardenlinux_commit(gardenlinux_root: str, limit: Optional[int] = None) -
3636
else:
3737
return commit_str
3838

39-
def get_features_dict(
40-
cname: str, gardenlinux_root: str, feature_dir_name: str = "features"
41-
) -> dict:
42-
"""
43-
:param str cname: the target cname to get the feature dict for
44-
:param str gardenlinux_root: path of garden linux src root
45-
:return: dict with list of features for a given cname, split into platform, element and flag
46-
47-
"""
48-
49-
return Parser(gardenlinux_root, feature_dir_name).filter_as_dict(cname)
50-
51-
def get_features_graph(
52-
cname: str, gardenlinux_root: str, feature_dir_name: str = "features"
53-
) -> networkx.Graph:
54-
"""
55-
:param str cname: the target cname to get the feature dict for
56-
:param str gardenlinux_root: path of garden linux src root
57-
:return: list of features for a given cname
58-
59-
"""
60-
61-
return Parser(gardenlinux_root, feature_dir_name).filter(cname)
62-
63-
def get_features_list(
64-
cname: str, gardenlinux_root: str, feature_dir_name: str = "features"
65-
) -> list:
66-
"""
67-
:param str cname: the target cname to get the feature dict for
68-
:param str gardenlinux_root: path of garden linux src root
69-
:return: list of features for a given cname
70-
71-
"""
72-
73-
return Parser(gardenlinux_root, feature_dir_name).filter_as_list(cname)
74-
75-
def get_features(
76-
cname: str, gardenlinux_root: str, feature_dir_name: str = "features"
77-
) -> str:
78-
"""
79-
:param str cname: the target cname to get the feature set for
80-
:param str gardenlinux_root: path of garden linux src root
81-
:return: a comma separated string with the expanded feature set for the cname
82-
"""
83-
84-
return Parser(gardenlinux_root, feature_dir_name).filter_as_string(cname)
85-
8639
def construct_layer_metadata(
8740
filetype: str, cname: str, version: str, arch: str, commit: str
8841
) -> dict:
@@ -123,7 +76,7 @@ def get_file_set_from_cname(cname: str, version: str, arch: str, gardenlinux_roo
12376
:return: set of file names for a given cname
12477
"""
12578
file_set = set()
126-
features_by_type = get_features_dict(cname, gardenlinux_root)
79+
features_by_type = Parser(gardenlinux_root).filter_as_dict(cname)
12780
commit_str = get_gardenlinux_commit(gardenlinux_root, 8)
12881

12982
if commit_str == "local":

src/python_gardenlinux_lib/flavors/parse_flavors.py

Lines changed: 0 additions & 230 deletions
This file was deleted.

src/python_gardenlinux_lib/version.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import requests
55
from pathlib import Path
66

7-
from .logger import LoggerSetup
8-
from .features.parse_features import get_features
7+
from gardenlinux.logger import LoggerSetup
98

109

1110
class Version:

tests/test_get_features_dict.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from python_gardenlinux_lib.features.parse_features import get_features_dict
3+
from gardenlinux.features import Parser
44
from tests.conftest import GL_ROOT_DIR
55

66

@@ -66,5 +66,5 @@ def test_get_features_dict(input_cname: str, expected_output: dict):
6666
features have changed since writing this test. In this case, update the expected output accordingly.
6767
You can print the output of get_features_dict so you have the dict in the expected format.
6868
"""
69-
features_dict = get_features_dict(input_cname, GL_ROOT_DIR)
69+
features_dict = Parser(GL_ROOT_DIR).filter_as_dict(input_cname)
7070
assert features_dict == expected_output

tests/test_parse_debsource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from python_gardenlinux_lib.apt.parse_debsource import DebsrcFile
1+
from gardenlinux.apt import DebsrcFile
22
import io
33

44
test_data = """Package: vim

tests/test_push_image.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import pytest
22
import os
33

4+
from gardenlinux.features import Parser
5+
from python_gardenlinux_lib.features.parse_features import get_oci_metadata
46
from python_gardenlinux_lib.oras.registry import GlociRegistry
5-
from python_gardenlinux_lib.features import parse_features
67

78
CONTAINER_NAME_ZOT_EXAMPLE = "127.0.0.1:18081/gardenlinux-example"
89
GARDENLINUX_ROOT_DIR_EXAMPLE = "test-data/gardenlinux/"
@@ -27,12 +28,12 @@
2728
],
2829
)
2930
def test_push_example(version, cname, arch):
30-
oci_metadata = parse_features.get_oci_metadata(
31+
oci_metadata = get_oci_metadata(
3132
cname, version, arch, GARDENLINUX_ROOT_DIR_EXAMPLE
3233
)
3334
container_name = f"{CONTAINER_NAME_ZOT_EXAMPLE}:{version}"
3435
a_registry = GlociRegistry(container_name=container_name, insecure=True)
35-
features = parse_features.get_features(cname, GARDENLINUX_ROOT_DIR_EXAMPLE)
36+
features = Parser(GARDENLINUX_ROOT_DIR_EXAMPLE).filter(cname)
3637
a_registry.push_image_manifest(
3738
arch,
3839
cname,

0 commit comments

Comments
 (0)