File tree 3 files changed +6
-10
lines changed
3 files changed +6
-10
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
13
12
from typing import Literal
14
13
15
14
from pydantic import BaseModel , ConfigDict
@@ -123,7 +122,7 @@ def get_attribution_key(
123
122
124
123
class Resource (BaseModel ):
125
124
model_config = ConfigDict (extra = "forbid" )
126
- path : Path
125
+ path : PurePosixPath
127
126
type : ResourceType | None = None
128
127
attributions : list [OpossumPackage ] = []
129
128
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
9
-
10
8
import opossum_lib .opossum_model as opossum_model
11
9
from opossum_lib .scancode .constants import SCANCODE_SOURCE_NAME
12
10
from opossum_lib .scancode .model import File , FileType , ScanCodeData
13
11
14
12
15
13
def scancode_to_file_tree (scancode_data : ScanCodeData ) -> opossum_model .Resource :
16
- temp_root = opossum_model .Resource (path = Path ("" ))
14
+ temp_root = opossum_model .Resource (path = PurePosixPath ("" ))
17
15
for file in scancode_data .files :
18
16
resource = opossum_model .Resource (
19
- path = Path (file .path ),
17
+ path = PurePosixPath (file .path . replace ( " \\ " , "/" ) ),
20
18
attributions = get_attribution_info (file ),
21
19
type = convert_resource_type (file .type ),
22
20
)
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
6
5
7
6
from opossum_lib .scancode .model import (
8
7
Copyright ,
@@ -83,11 +82,11 @@ def _create_file(
83
82
if copyrights is None :
84
83
copyrights = []
85
84
if name is None :
86
- name = Path (path ).name
85
+ name = PurePosixPath (path ).name
87
86
if base_name is None :
88
- base_name = Path ( Path (path ).name ).stem
87
+ base_name = PurePosixPath ( PurePosixPath (path ).name ).stem
89
88
if extension is None :
90
- extension = Path (path ).suffix
89
+ extension = PurePosixPath (path ).suffix
91
90
return File (
92
91
authors = authors ,
93
92
base_name = base_name ,
You can’t perform that action at this time.
0 commit comments