File tree 3 files changed +10
-9
lines changed
3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 9
9
from collections .abc import Iterable
10
10
from dataclasses import field
11
11
from enum import Enum , auto
12
- from pathlib import Path
12
+ from pathlib import PurePath
13
13
from typing import Literal
14
14
15
15
from pydantic import BaseModel , ConfigDict
@@ -123,7 +123,7 @@ def get_attribution_key(
123
123
124
124
class Resource (BaseModel ):
125
125
model_config = ConfigDict (extra = "forbid" )
126
- path : Path
126
+ path : PurePath
127
127
type : ResourceType | None = None
128
128
attributions : list [OpossumPackage ] = []
129
129
children : dict [str , Resource ] = {}
Original file line number Diff line number Diff line change 5
5
6
6
from __future__ import annotations
7
7
8
- from pathlib import Path
8
+ from pathlib import PurePath
9
9
10
10
import opossum_lib .opossum_model as opossum_model
11
11
from opossum_lib .scancode .constants import SCANCODE_SOURCE_NAME
12
12
from opossum_lib .scancode .model import File , FileType , ScanCodeData
13
13
14
14
15
15
def scancode_to_file_tree (scancode_data : ScanCodeData ) -> opossum_model .Resource :
16
- temp_root = opossum_model .Resource (path = Path ("" ))
16
+ temp_root = opossum_model .Resource (path = PurePath ("" ))
17
17
for file in scancode_data .files :
18
18
resource = opossum_model .Resource (
19
- path = Path (file .path ),
19
+ path = PurePath (file .path . replace ( " \\ " , "/" ) ),
20
20
attributions = get_attribution_info (file ),
21
21
type = convert_resource_type (file .type ),
22
22
)
Original file line number Diff line number Diff line change 2
2
#
3
3
# SPDX-License-Identifier: Apache-2.0
4
4
5
- from pathlib import Path
5
+
6
+ from pathlib import PurePath
6
7
7
8
from opossum_lib .scancode .model import (
8
9
Copyright ,
@@ -83,11 +84,11 @@ def _create_file(
83
84
if copyrights is None :
84
85
copyrights = []
85
86
if name is None :
86
- name = Path (path ).name
87
+ name = PurePath (path ).name
87
88
if base_name is None :
88
- base_name = Path ( Path (path ).name ).stem
89
+ base_name = PurePath ( PurePath (path ).name ).stem
89
90
if extension is None :
90
- extension = Path (path ).suffix
91
+ extension = PurePath (path ).suffix
91
92
return File (
92
93
authors = authors ,
93
94
base_name = base_name ,
You can’t perform that action at this time.
0 commit comments