Skip to content

Commit 4aab7ae

Browse files
committed
Drop strip_root/full_root codebase attributes
The Codebase and VirtualCodebase no longer have a "full_root" and "strip_root" constructor arguments and attributes. These can still be passed but they will be ignored. These were needed only for path output and this is now were these arguments and code lives. - Resource.path is now always the plain path where the first segment is the last segment of the root location, e.g. the root fiename. - The Resource now has new "full_root_path" and "strip_root_path" properties that return the corresponding paths. - The Resource.to_dict and the new Codebase.to_list both have a new "full_root" and "strip_root" arguments - The Resource.get_path() method accepts "full_root" and "strip_root" arguments. - The Resource.create_child() method has been removed. - The "Codebase.original_location" attributed has been removed. No known users of commoncode used this. Also format code and organize imports. Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent ed0d463 commit 4aab7ae

File tree

3 files changed

+359
-335
lines changed

3 files changed

+359
-335
lines changed

CHANGELOG.rst

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ TBD.
99
Version 31.0.0 - (2022-05-16)
1010
------------------------------
1111

12-
This is a major version with API-breaking behavious changes in the reosurce
13-
module.
12+
This is a major version with API-breaking changes in the resource module.
1413

1514
- The Resource has no rid (resource id) and no pid (parent id). Instead
1615
we now use internally a simpler mapping of {path: Resource} object.
@@ -21,7 +20,7 @@ module.
2120
of paths. When provided, the Codebase will only contain Resources with these
2221
paths and no other resources. This handy to create a Codebase with only a
2322
subset of paths of interest. When we create a Codebase or VirtualCodebase
24-
with paths, we also always create any internediate directories. So if you
23+
with paths, we also always create any intermediate directories. So if you
2524
ask for a path of "root/dir/file", we create three resources: "root",
2625
"root/dir" and "root/dir/file". We accumulate codebase errors if the paths
2726
does not exists in the Codebase or VirtualCodebase. The paths must start with
@@ -33,9 +32,11 @@ module.
3332
and inconsistent when each location "files" were sharing leading path
3433
segments. So if you provide to JSON inputs with that each contain the path
3534
"root/dir/file", the VirtualCodebase will contain these paths:
35+
3636
- "virtual_root/codebase-1/root/dir/file"
3737
- "virtual_root/codebase-2/root/dir/file"
38-
It is otherwise practically impossble to correctly merge file data from
38+
39+
It is otherwise practically impossible to correctly merge file data from
3940
multiple codebases reliably, so adding this prefix ensures that we are doing
4041
the right thing
4142

@@ -48,21 +49,40 @@ module.
4849
the directory tree for any intermediary directory used in a path that is
4950
otherwise missing from files path list.
5051
In particular this behaviour changed when you create a VirtualCodebase from
51-
a pervious Codebase created with a "full_root" argument. Previously, the
52+
a previous Codebase created with a "full_root" argument. Previously, the
5253
missing paths of a "full_root" Codebase were kept unchanged.
53-
Noet that the VirtualCodebase has always ignored the "full_root" argument.
54+
Note that the VirtualCodebase has always ignored the "full_root" argument.
5455

5556
- The Codebase and VirtualCodebase are now iterable. Iterating on a codebase
5657
is the same as a top-down walk.
5758

59+
- The "Codebase.original_location" attributed has been removed.
60+
No known users of commoncode used this.
61+
62+
- The Codebase and VirtualCodebase no longer have a "full_root" and
63+
"strip_root" constructor arguments and attributes. These can still be
64+
passed but they will be ignored.
65+
66+
- Resource.path is now always the plain path where the first segment
67+
is the last segment of the root location, e.g. the root fiename.
68+
69+
- The Resource now has new "full_root_path" and "strip_root_path"
70+
properties that return the corresponding paths.
71+
72+
- The Resource.to_dict and the new Codebase.to_list both have a new
73+
"full_root" and "strip_root" arguments
74+
75+
- The Resource.get_path() method accepts "full_root" and "strip_root" arguments.
76+
77+
- The Resource.create_child() method has been removed.
5878

5979
Other changes:
6080

6181
- Remove Python upper version limit.
6282
- Merge latest skeleton
6383
- fileutils.parent_directory() now accepts a "with_trail" argument.
6484
The returned directory has a trailing path separator unless with_trail is False.
65-
The default is True and the default behavious is unchanged.
85+
The default is True and the default behaviour is unchanged.
6686

6787

6888
Version 30.2.0 - (2022-05-02)
@@ -97,7 +117,7 @@ Version 30.1.0 (2022-04-05)
97117
Version 30.0.0 (2021-09-24)
98118
------------------------------
99119

100-
- Switch back from clamver to semver.
120+
- Switch back from calver to semver.
101121
- Adopt latest skeleton. The default virtualenv directory is now venv and no
102122
longer tmp
103123
- Fix issue with Click progressbar API #23 that prohibited to use all supported

0 commit comments

Comments
 (0)