sphinx-cmd 0.4.1__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sphinx_cmd-0.4.1/sphinx_cmd.egg-info → sphinx_cmd-0.4.3}/PKG-INFO +1 -1
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd/__init__.py +1 -1
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd/commands/mv.py +13 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd/commands/rm.py +40 -9
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3/sphinx_cmd.egg-info}/PKG-INFO +1 -1
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/LICENSE +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/MANIFEST.in +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/README.md +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/pyproject.toml +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/setup.cfg +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd/cli.py +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd/commands/__init__.py +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd/config.py +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd/py.typed +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd.egg-info/SOURCES.txt +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd.egg-info/dependency_links.txt +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd.egg-info/entry_points.txt +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd.egg-info/requires.txt +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/sphinx_cmd.egg-info/top_level.txt +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/tests/test_cli.py +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/tests/test_config.py +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/tests/test_custom_directives.py +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/tests/test_integration.py +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/tests/test_mv.py +0 -0
- {sphinx_cmd-0.4.1 → sphinx_cmd-0.4.3}/tests/test_rm.py +0 -0
|
@@ -83,8 +83,15 @@ def extract_references(
|
|
|
83
83
|
else:
|
|
84
84
|
ref_path = match
|
|
85
85
|
references[ref_type].append(ref_path)
|
|
86
|
+
|
|
86
87
|
if verbose:
|
|
87
88
|
print(f"Found {ref_type} reference: {ref_path}")
|
|
89
|
+
# For references that could be image files or other assets,
|
|
90
|
+
# show absolute path
|
|
91
|
+
if ref_type in ["image", "figure", "include"]:
|
|
92
|
+
ref_full_path = Path(file_path).parent / ref_path
|
|
93
|
+
ref_abs_path = ref_full_path.resolve()
|
|
94
|
+
print(f" Absolute path: {ref_abs_path}")
|
|
88
95
|
|
|
89
96
|
if verbose and not references:
|
|
90
97
|
print(f"No references found in {file_path}")
|
|
@@ -133,6 +140,12 @@ def find_files_referencing(
|
|
|
133
140
|
referencing_files.append((file_path, ref_type))
|
|
134
141
|
if verbose:
|
|
135
142
|
print(f"Found reference in {file_path} ({ref_type}): {ref}")
|
|
143
|
+
# For references that could be image files or other assets,
|
|
144
|
+
# show absolute path
|
|
145
|
+
if ref_type in ["image", "figure", "include"]:
|
|
146
|
+
ref_full_path = Path(file_path).parent / ref
|
|
147
|
+
ref_abs_path = ref_full_path.resolve()
|
|
148
|
+
print(f" Absolute path: {ref_abs_path}")
|
|
136
149
|
break
|
|
137
150
|
except Exception as e:
|
|
138
151
|
print(f"Warning: Could not analyze {file_path}: {e}")
|
|
@@ -22,12 +22,21 @@ def find_rst_files(path):
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def extract_assets(
|
|
25
|
-
file_path,
|
|
25
|
+
file_path,
|
|
26
|
+
visited=None,
|
|
27
|
+
cli_directives=None,
|
|
28
|
+
context_path=None,
|
|
29
|
+
verbose=False,
|
|
30
|
+
base_dir=None,
|
|
26
31
|
):
|
|
27
32
|
"""Extract asset references from an .rst file, recursively parsing includes."""
|
|
28
33
|
if visited is None:
|
|
29
34
|
visited = set()
|
|
30
35
|
|
|
36
|
+
# Use the directory of the original file as base for relative path resolution
|
|
37
|
+
if base_dir is None:
|
|
38
|
+
base_dir = os.path.dirname(file_path)
|
|
39
|
+
|
|
31
40
|
# Avoid circular includes
|
|
32
41
|
abs_path = os.path.abspath(file_path)
|
|
33
42
|
if abs_path in visited:
|
|
@@ -52,23 +61,34 @@ def extract_assets(
|
|
|
52
61
|
for directive, pattern in directive_patterns.items():
|
|
53
62
|
for match in pattern.findall(content):
|
|
54
63
|
asset_path = match.strip()
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
if directive == "include":
|
|
65
|
+
# Include paths are resolved relative to the current file
|
|
66
|
+
asset_full_path = os.path.normpath(
|
|
67
|
+
os.path.join(os.path.dirname(file_path), asset_path)
|
|
68
|
+
)
|
|
69
|
+
else:
|
|
70
|
+
# Non-include assets are resolved relative to the base directory
|
|
71
|
+
asset_full_path = os.path.normpath(
|
|
72
|
+
os.path.join(base_dir, asset_path)
|
|
73
|
+
)
|
|
74
|
+
asset_abs_path = os.path.abspath(asset_full_path)
|
|
58
75
|
|
|
59
76
|
if verbose:
|
|
60
77
|
print(f"Found {directive}: {asset_path}")
|
|
78
|
+
print(f" Absolute path: {asset_abs_path}")
|
|
61
79
|
|
|
62
80
|
if directive == "include":
|
|
63
81
|
if verbose:
|
|
64
82
|
print(f"Parsing include: {asset_full_path}")
|
|
65
|
-
# Recursively extract assets from included files
|
|
83
|
+
# Recursively extract assets from included files,
|
|
84
|
+
# preserving base_dir
|
|
66
85
|
included_assets = extract_assets(
|
|
67
86
|
asset_full_path,
|
|
68
|
-
visited
|
|
87
|
+
visited,
|
|
69
88
|
cli_directives,
|
|
70
89
|
context_path,
|
|
71
90
|
verbose,
|
|
91
|
+
base_dir,
|
|
72
92
|
)
|
|
73
93
|
asset_directives.update(included_assets)
|
|
74
94
|
|
|
@@ -107,12 +127,21 @@ def build_asset_index(rst_files, cli_directives=None, context_path=None, verbose
|
|
|
107
127
|
|
|
108
128
|
|
|
109
129
|
def get_transitive_includes(
|
|
110
|
-
file_path,
|
|
130
|
+
file_path,
|
|
131
|
+
visited=None,
|
|
132
|
+
cli_directives=None,
|
|
133
|
+
context_path=None,
|
|
134
|
+
verbose=False,
|
|
135
|
+
base_dir=None,
|
|
111
136
|
):
|
|
112
137
|
"""Get all files included transitively from a file."""
|
|
113
138
|
if visited is None:
|
|
114
139
|
visited = set()
|
|
115
140
|
|
|
141
|
+
# Use the directory of the original file as base for relative path resolution
|
|
142
|
+
if base_dir is None:
|
|
143
|
+
base_dir = os.path.dirname(file_path)
|
|
144
|
+
|
|
116
145
|
# Avoid circular includes
|
|
117
146
|
abs_path = os.path.abspath(file_path)
|
|
118
147
|
if abs_path in visited:
|
|
@@ -146,14 +175,16 @@ def get_transitive_includes(
|
|
|
146
175
|
if verbose:
|
|
147
176
|
print(f"Found include: {include_path}")
|
|
148
177
|
|
|
149
|
-
# Recursively get includes from the included file
|
|
178
|
+
# Recursively get includes from the included file,
|
|
179
|
+
# preserving base_dir
|
|
150
180
|
includes.update(
|
|
151
181
|
get_transitive_includes(
|
|
152
182
|
include_full_path,
|
|
153
|
-
visited
|
|
183
|
+
visited,
|
|
154
184
|
cli_directives,
|
|
155
185
|
context_path,
|
|
156
186
|
verbose,
|
|
187
|
+
base_dir,
|
|
157
188
|
)
|
|
158
189
|
)
|
|
159
190
|
except Exception as e:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|