unctools 0.1.0__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.
- unctools-0.1.0/LICENSE +21 -0
- unctools-0.1.0/MANIFEST.in +16 -0
- unctools-0.1.0/PKG-INFO +189 -0
- unctools-0.1.0/README.md +140 -0
- unctools-0.1.0/docs/implementation-guide.md +213 -0
- unctools-0.1.0/docs/implementation-summary.md +129 -0
- unctools-0.1.0/docs/integration-guide.md +79 -0
- unctools-0.1.0/examples/basic_usage.py +208 -0
- unctools-0.1.0/examples/batch_operations.py +302 -0
- unctools-0.1.0/examples/windows_zone_fix.py +201 -0
- unctools-0.1.0/pyproject.toml +85 -0
- unctools-0.1.0/setup.cfg +86 -0
- unctools-0.1.0/setup.py +78 -0
- unctools-0.1.0/tests/__init__.py +9 -0
- unctools-0.1.0/tests/basic_functionality_test.py +194 -0
- unctools-0.1.0/tests/conftest.py +35 -0
- unctools-0.1.0/tests/test_converter.py +235 -0
- unctools-0.1.0/tests/test_converter_v2.py +222 -0
- unctools-0.1.0/tests/test_detector.py +386 -0
- unctools-0.1.0/tests/test_framework.py +270 -0
- unctools-0.1.0/tests/test_operations.py +649 -0
- unctools-0.1.0/tests/test_win32net_warning.py +163 -0
- unctools-0.1.0/tests/test_windows.py +245 -0
- unctools-0.1.0/tests/test_windows_imports.py +198 -0
- unctools-0.1.0/unctools/__init__.py +100 -0
- unctools-0.1.0/unctools/converter.py +378 -0
- unctools-0.1.0/unctools/detector.py +531 -0
- unctools-0.1.0/unctools/operations.py +562 -0
- unctools-0.1.0/unctools/utils/__init__.py +40 -0
- unctools-0.1.0/unctools/utils/compat.py +331 -0
- unctools-0.1.0/unctools/utils/logger.py +228 -0
- unctools-0.1.0/unctools/utils/validation.py +321 -0
- unctools-0.1.0/unctools/windows/__init__.py +45 -0
- unctools-0.1.0/unctools/windows/network.py +490 -0
- unctools-0.1.0/unctools/windows/registry.py +410 -0
- unctools-0.1.0/unctools/windows/security.py +586 -0
- unctools-0.1.0/unctools.egg-info/PKG-INFO +189 -0
- unctools-0.1.0/unctools.egg-info/SOURCES.txt +41 -0
- unctools-0.1.0/unctools.egg-info/dependency_links.txt +1 -0
- unctools-0.1.0/unctools.egg-info/not-zip-safe +1 -0
- unctools-0.1.0/unctools.egg-info/requires.txt +19 -0
- unctools-0.1.0/unctools.egg-info/top_level.txt +1 -0
unctools-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dustin Darcy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include pyproject.toml
|
|
4
|
+
include setup.py
|
|
5
|
+
include setup.cfg
|
|
6
|
+
include MANIFEST.in
|
|
7
|
+
|
|
8
|
+
recursive-include examples *.py
|
|
9
|
+
recursive-include tests *.py
|
|
10
|
+
recursive-include docs *.md *.rst *.txt *.png *.jpg
|
|
11
|
+
|
|
12
|
+
recursive-exclude * __pycache__
|
|
13
|
+
recursive-exclude * *.py[cod]
|
|
14
|
+
recursive-exclude * *.so
|
|
15
|
+
recursive-exclude * .DS_Store
|
|
16
|
+
recursive-exclude * Thumbs.db
|
unctools-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unctools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A comprehensive toolkit for handling UNC paths, network drives, and substituted drives
|
|
5
|
+
Home-page: https://github.com/djdacy/unctools
|
|
6
|
+
Author: Dustin Darcy
|
|
7
|
+
Author-email: Dustin Darcy <your.email@example.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/djdarcy/unctools
|
|
10
|
+
Project-URL: Bug Reports, https://github.com/djdarcy/unctools/issues
|
|
11
|
+
Project-URL: Source, https://github.com/djdarcy/unctools
|
|
12
|
+
Project-URL: Documentation, https://github.com/djdarcy/unctools#readme
|
|
13
|
+
Keywords: unc,network,windows,path,file,share,subst
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
24
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
25
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
26
|
+
Classifier: Topic :: System :: Filesystems
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.6
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: pathlib; python_version < "3.4"
|
|
32
|
+
Provides-Extra: windows
|
|
33
|
+
Requires-Dist: pywin32>=223; extra == "windows"
|
|
34
|
+
Requires-Dist: pypiwin32>=223; extra == "windows"
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest>=6.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov>=2.10.0; extra == "dev"
|
|
38
|
+
Requires-Dist: flake8>=3.8.0; extra == "dev"
|
|
39
|
+
Requires-Dist: black>=20.8b1; extra == "dev"
|
|
40
|
+
Requires-Dist: tox>=3.20.0; extra == "dev"
|
|
41
|
+
Provides-Extra: docs
|
|
42
|
+
Requires-Dist: sphinx>=4.0.0; extra == "docs"
|
|
43
|
+
Requires-Dist: sphinx-rtd-theme>=0.5.0; extra == "docs"
|
|
44
|
+
Requires-Dist: myst-parser>=0.15.0; extra == "docs"
|
|
45
|
+
Dynamic: author
|
|
46
|
+
Dynamic: home-page
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
Dynamic: requires-python
|
|
49
|
+
|
|
50
|
+
# UNCtools
|
|
51
|
+
|
|
52
|
+
A comprehensive toolkit for handling UNC paths, network drives, and substituted drives across different environments.
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
- Convert between UNC paths (\\\\server\\share) and local drive paths (Z:\\)
|
|
57
|
+
- Detect UNC paths, network drives, and substituted drives
|
|
58
|
+
- Handle Windows security zones for improved UNC path access
|
|
59
|
+
- Provide high-level file operations that work seamlessly with UNC paths
|
|
60
|
+
- Cross-platform compatibility with graceful degradation
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
### Standard Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install unctools
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### With Windows-specific Support
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install unctools[windows]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Development Mode
|
|
77
|
+
|
|
78
|
+
For development and testing:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/yourusername/unctools.git
|
|
82
|
+
cd unctools
|
|
83
|
+
pip install -e .[dev]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
### Basic Path Conversion
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from unctools import convert_to_local, convert_to_unc
|
|
92
|
+
|
|
93
|
+
# Convert UNC path to local drive path
|
|
94
|
+
local_path = convert_to_local("\\\\server\\share\\folder\\file.txt")
|
|
95
|
+
# Result (if mapped): "Z:\\folder\\file.txt"
|
|
96
|
+
|
|
97
|
+
# Convert local drive path back to UNC
|
|
98
|
+
unc_path = convert_to_unc("Z:\\folder\\file.txt")
|
|
99
|
+
# Result: "\\\\server\\share\\folder\\file.txt"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Path Detection
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from unctools import is_unc_path, is_network_drive, is_subst_drive, get_path_type
|
|
106
|
+
|
|
107
|
+
# Check if a path is a UNC path
|
|
108
|
+
if is_unc_path("\\\\server\\share\\file.txt"):
|
|
109
|
+
print("This is a UNC path")
|
|
110
|
+
|
|
111
|
+
# Check if a drive is a network drive
|
|
112
|
+
if is_network_drive("Z:"):
|
|
113
|
+
print("Z: is a network drive")
|
|
114
|
+
|
|
115
|
+
# Get the type of a path
|
|
116
|
+
path_type = get_path_type("C:\\Users\\")
|
|
117
|
+
# Result: "local", "network", "subst", "unc", etc.
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Safe File Operations
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from unctools import safe_open, safe_copy, batch_convert
|
|
124
|
+
|
|
125
|
+
# Open a file, handling UNC paths automatically
|
|
126
|
+
with safe_open("\\\\server\\share\\file.txt", "r") as f:
|
|
127
|
+
content = f.read()
|
|
128
|
+
|
|
129
|
+
# Copy a file, handling path conversions
|
|
130
|
+
safe_copy("\\\\server\\share\\file.txt", "local_copy.txt")
|
|
131
|
+
|
|
132
|
+
# Convert multiple paths at once
|
|
133
|
+
paths = ["\\\\server\\share\\file1.txt", "\\\\server\\share\\file2.txt"]
|
|
134
|
+
converted = batch_convert(paths, to_unc=False)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Windows Security Zones
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from unctools.windows import fix_security_zone, add_to_intranet_zone
|
|
141
|
+
|
|
142
|
+
# Fix security zone issues for a server
|
|
143
|
+
fix_security_zone("server")
|
|
144
|
+
|
|
145
|
+
# Add a server to the Local Intranet zone
|
|
146
|
+
add_to_intranet_zone("server")
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Network Drive Management
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from unctools.windows import create_network_mapping, remove_network_mapping
|
|
153
|
+
|
|
154
|
+
# Create a network drive mapping
|
|
155
|
+
success, drive = create_network_mapping("\\\\server\\share", "Z:")
|
|
156
|
+
|
|
157
|
+
# Remove a network drive mapping
|
|
158
|
+
remove_network_mapping("Z:")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Platform Compatibility
|
|
162
|
+
|
|
163
|
+
UNCtools is designed to work across various platforms:
|
|
164
|
+
|
|
165
|
+
- **Windows**: Full functionality including security zones and network drive management
|
|
166
|
+
- **Linux/macOS**: Basic path conversion and detection, with graceful degradation for Windows-specific features
|
|
167
|
+
|
|
168
|
+
## Development
|
|
169
|
+
|
|
170
|
+
### Running Tests
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
pytest
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Code Style
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
black unctools
|
|
180
|
+
flake8 unctools
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT
|
|
186
|
+
|
|
187
|
+
## Contributing
|
|
188
|
+
|
|
189
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
unctools-0.1.0/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# UNCtools
|
|
2
|
+
|
|
3
|
+
A comprehensive toolkit for handling UNC paths, network drives, and substituted drives across different environments.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Convert between UNC paths (\\\\server\\share) and local drive paths (Z:\\)
|
|
8
|
+
- Detect UNC paths, network drives, and substituted drives
|
|
9
|
+
- Handle Windows security zones for improved UNC path access
|
|
10
|
+
- Provide high-level file operations that work seamlessly with UNC paths
|
|
11
|
+
- Cross-platform compatibility with graceful degradation
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### Standard Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install unctools
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### With Windows-specific Support
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install unctools[windows]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Development Mode
|
|
28
|
+
|
|
29
|
+
For development and testing:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/yourusername/unctools.git
|
|
33
|
+
cd unctools
|
|
34
|
+
pip install -e .[dev]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
### Basic Path Conversion
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from unctools import convert_to_local, convert_to_unc
|
|
43
|
+
|
|
44
|
+
# Convert UNC path to local drive path
|
|
45
|
+
local_path = convert_to_local("\\\\server\\share\\folder\\file.txt")
|
|
46
|
+
# Result (if mapped): "Z:\\folder\\file.txt"
|
|
47
|
+
|
|
48
|
+
# Convert local drive path back to UNC
|
|
49
|
+
unc_path = convert_to_unc("Z:\\folder\\file.txt")
|
|
50
|
+
# Result: "\\\\server\\share\\folder\\file.txt"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Path Detection
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from unctools import is_unc_path, is_network_drive, is_subst_drive, get_path_type
|
|
57
|
+
|
|
58
|
+
# Check if a path is a UNC path
|
|
59
|
+
if is_unc_path("\\\\server\\share\\file.txt"):
|
|
60
|
+
print("This is a UNC path")
|
|
61
|
+
|
|
62
|
+
# Check if a drive is a network drive
|
|
63
|
+
if is_network_drive("Z:"):
|
|
64
|
+
print("Z: is a network drive")
|
|
65
|
+
|
|
66
|
+
# Get the type of a path
|
|
67
|
+
path_type = get_path_type("C:\\Users\\")
|
|
68
|
+
# Result: "local", "network", "subst", "unc", etc.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Safe File Operations
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from unctools import safe_open, safe_copy, batch_convert
|
|
75
|
+
|
|
76
|
+
# Open a file, handling UNC paths automatically
|
|
77
|
+
with safe_open("\\\\server\\share\\file.txt", "r") as f:
|
|
78
|
+
content = f.read()
|
|
79
|
+
|
|
80
|
+
# Copy a file, handling path conversions
|
|
81
|
+
safe_copy("\\\\server\\share\\file.txt", "local_copy.txt")
|
|
82
|
+
|
|
83
|
+
# Convert multiple paths at once
|
|
84
|
+
paths = ["\\\\server\\share\\file1.txt", "\\\\server\\share\\file2.txt"]
|
|
85
|
+
converted = batch_convert(paths, to_unc=False)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Windows Security Zones
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from unctools.windows import fix_security_zone, add_to_intranet_zone
|
|
92
|
+
|
|
93
|
+
# Fix security zone issues for a server
|
|
94
|
+
fix_security_zone("server")
|
|
95
|
+
|
|
96
|
+
# Add a server to the Local Intranet zone
|
|
97
|
+
add_to_intranet_zone("server")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Network Drive Management
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from unctools.windows import create_network_mapping, remove_network_mapping
|
|
104
|
+
|
|
105
|
+
# Create a network drive mapping
|
|
106
|
+
success, drive = create_network_mapping("\\\\server\\share", "Z:")
|
|
107
|
+
|
|
108
|
+
# Remove a network drive mapping
|
|
109
|
+
remove_network_mapping("Z:")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Platform Compatibility
|
|
113
|
+
|
|
114
|
+
UNCtools is designed to work across various platforms:
|
|
115
|
+
|
|
116
|
+
- **Windows**: Full functionality including security zones and network drive management
|
|
117
|
+
- **Linux/macOS**: Basic path conversion and detection, with graceful degradation for Windows-specific features
|
|
118
|
+
|
|
119
|
+
## Development
|
|
120
|
+
|
|
121
|
+
### Running Tests
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pytest
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Code Style
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
black unctools
|
|
131
|
+
flake8 unctools
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
|
137
|
+
|
|
138
|
+
## Contributing
|
|
139
|
+
|
|
140
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# UNCtools - Implementation Guide and Testing Instructions
|
|
2
|
+
|
|
3
|
+
## Implementation Status
|
|
4
|
+
|
|
5
|
+
We have successfully completed the initial implementation of the UNCtools package with the following components:
|
|
6
|
+
|
|
7
|
+
### Core Module Structure
|
|
8
|
+
- ✅ `unctools/__init__.py` - Package initialization and exports
|
|
9
|
+
- ✅ `unctools/converter.py` - Path conversion utilities
|
|
10
|
+
- ✅ `unctools/detector.py` - Path type detection utilities
|
|
11
|
+
- ✅ `unctools/operations.py` - High-level file operations
|
|
12
|
+
|
|
13
|
+
### Utility Modules
|
|
14
|
+
- ✅ `unctools/utils/__init__.py` - Utilities package initialization
|
|
15
|
+
- ✅ `unctools/utils/logger.py` - Logging configuration
|
|
16
|
+
- ✅ `unctools/utils/compat.py` - Cross-platform compatibility
|
|
17
|
+
- ✅ `unctools/utils/validation.py` - Path validation
|
|
18
|
+
|
|
19
|
+
### Windows-Specific Modules
|
|
20
|
+
- ✅ `unctools/windows/__init__.py` - Windows package initialization
|
|
21
|
+
- ✅ `unctools/windows/registry.py` - Registry operations
|
|
22
|
+
- ✅ `unctools/windows/network.py` - Network operations
|
|
23
|
+
- ✅ `unctools/windows/security.py` - Security operations
|
|
24
|
+
|
|
25
|
+
### Package Files
|
|
26
|
+
- ✅ `setup.py` - Installation script
|
|
27
|
+
- ✅ `setup.cfg` - Package configuration
|
|
28
|
+
- ✅ `pyproject.toml` - Modern packaging
|
|
29
|
+
- ✅ `MANIFEST.in` - Package file inclusion
|
|
30
|
+
- ✅ `LICENSE` - MIT License
|
|
31
|
+
- ✅ `README.md` - Package documentation
|
|
32
|
+
- ✅ `.gitignore` - Git ignore patterns
|
|
33
|
+
|
|
34
|
+
### Examples and Tests
|
|
35
|
+
- ✅ `examples/basic_usage.py` - Basic usage examples
|
|
36
|
+
- ✅ `examples/windows_zone_fix.py` - Windows security zone fixing
|
|
37
|
+
- ✅ `examples/batch_operations.py` - Batch file operations
|
|
38
|
+
- ✅ `tests/__init__.py` - Tests package initialization
|
|
39
|
+
- ✅ `tests/test_converter.py` - Test for the converter module
|
|
40
|
+
- ✅ `tests/basic_functionality_test.py` - Basic functionality verification
|
|
41
|
+
|
|
42
|
+
## Testing Instructions
|
|
43
|
+
|
|
44
|
+
To test the UNCtools package, follow these steps:
|
|
45
|
+
|
|
46
|
+
### 1. Install in Development Mode
|
|
47
|
+
|
|
48
|
+
First, install the package in development mode to allow for easy modifications:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Navigate to the UNCtools directory
|
|
52
|
+
cd path/to/unctools
|
|
53
|
+
|
|
54
|
+
# Install in development mode
|
|
55
|
+
pip install -e .
|
|
56
|
+
|
|
57
|
+
# To include Windows-specific dependencies (on Windows)
|
|
58
|
+
pip install -e ".[windows]"
|
|
59
|
+
|
|
60
|
+
# To include development tools
|
|
61
|
+
pip install -e ".[dev]"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 2. Run Basic Functionality Test
|
|
65
|
+
|
|
66
|
+
Test that the core functionality works correctly:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python tests/basic_functionality_test.py
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This script verifies that all modules can be imported and basic functions work as expected.
|
|
73
|
+
|
|
74
|
+
### 3. Test Path Conversion
|
|
75
|
+
|
|
76
|
+
Test UNC path conversion with:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# On Windows with a mapped network drive (e.g., Z: mapped to \\server\share)
|
|
80
|
+
python examples/basic_usage.py
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Look for proper path conversion and detection in the output.
|
|
84
|
+
|
|
85
|
+
### 4. Test Batch Operations
|
|
86
|
+
|
|
87
|
+
Test batch operations with:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Convert paths in a directory
|
|
91
|
+
python examples/batch_operations.py convert /path/to/directory --pattern "*.txt" --recursive
|
|
92
|
+
|
|
93
|
+
# Copy files from a directory to another location
|
|
94
|
+
python examples/batch_operations.py copy /path/to/source --dest /path/to/destination --pattern "*.txt" --recursive
|
|
95
|
+
|
|
96
|
+
# Process files in a directory
|
|
97
|
+
python examples/batch_operations.py process /path/to/directory --pattern "*.txt" --recursive
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 5. Test Windows-Specific Features (Windows Only)
|
|
101
|
+
|
|
102
|
+
Test Windows security zone features with:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Check and fix security zone issues for a UNC path
|
|
106
|
+
python examples/windows_zone_fix.py "\\server\share\folder"
|
|
107
|
+
|
|
108
|
+
# Scan a directory for UNC paths and fix security zones
|
|
109
|
+
python examples/windows_zone_fix.py --scan /path/to/directory --fix-all
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 6. Run Unit Tests
|
|
113
|
+
|
|
114
|
+
Run the unit tests for individual modules:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Run all tests
|
|
118
|
+
pytest
|
|
119
|
+
|
|
120
|
+
# Run tests for a specific module
|
|
121
|
+
pytest tests/test_converter.py
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Expected Output
|
|
125
|
+
|
|
126
|
+
The basic functionality test should produce output similar to:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
=== UNCtools Basic Functionality Tests ===
|
|
130
|
+
|
|
131
|
+
Testing imports...
|
|
132
|
+
✓ Import unctools
|
|
133
|
+
|
|
134
|
+
Checking version information...
|
|
135
|
+
✓ UNCtools version: 0.1.0
|
|
136
|
+
|
|
137
|
+
Testing core module imports...
|
|
138
|
+
✓ Import core functions
|
|
139
|
+
|
|
140
|
+
Testing utils module imports...
|
|
141
|
+
✓ Import utils functions
|
|
142
|
+
|
|
143
|
+
Testing Windows-specific module imports...
|
|
144
|
+
✓ Import Windows-specific functions
|
|
145
|
+
|
|
146
|
+
Testing basic functionality...
|
|
147
|
+
✓ is_unc_path(C:\Users\username) should be False
|
|
148
|
+
✓ is_unc_path(\\server\share\folder) should be True
|
|
149
|
+
✓ normalize_path(C:\Users\username) => C:\Users\username
|
|
150
|
+
✓ convert_to_local(\\server\share\folder) => \\server\share\folder
|
|
151
|
+
✓ convert_to_unc(C:\Users\username) => C:\Users\username
|
|
152
|
+
✓ batch_convert() returned 2 results
|
|
153
|
+
✓ Platform information: system: Windows, release: 10, ...
|
|
154
|
+
|
|
155
|
+
Testing file operations with a temporary file...
|
|
156
|
+
✓ safe_open() and read content: 'UNCtools test file'
|
|
157
|
+
✓ Temporary file operations completed
|
|
158
|
+
|
|
159
|
+
=== Test Summary ===
|
|
160
|
+
Platform: Windows 10
|
|
161
|
+
Python: 3.8.10
|
|
162
|
+
UNCtools: 0.1.0
|
|
163
|
+
All tests completed. Check the results above for any failures.
|
|
164
|
+
|
|
165
|
+
Basic functionality tests completed successfully.
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Common Issues and Troubleshooting
|
|
169
|
+
|
|
170
|
+
### Import Errors
|
|
171
|
+
|
|
172
|
+
If you see import errors:
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
✗ Import unctools: No module named 'unctools'
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Ensure you've installed the package in development mode and are running Python from the correct environment.
|
|
179
|
+
|
|
180
|
+
### Missing Windows Functionality
|
|
181
|
+
|
|
182
|
+
If Windows-specific features are unavailable:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
✗ Import Windows-specific functions: No module named 'win32api'
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Install the Windows extras:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
pip install -e ".[windows]"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Path Conversion Issues
|
|
195
|
+
|
|
196
|
+
If path conversion doesn't work as expected, check:
|
|
197
|
+
|
|
198
|
+
1. Your network drive mappings are active
|
|
199
|
+
2. The UNC paths are correctly formatted
|
|
200
|
+
3. You have appropriate permissions for the paths
|
|
201
|
+
|
|
202
|
+
## Next Steps
|
|
203
|
+
|
|
204
|
+
After completing these tests, we should:
|
|
205
|
+
|
|
206
|
+
1. Expand the test suite with more comprehensive tests
|
|
207
|
+
2. Create detailed API documentation
|
|
208
|
+
3. Consider integration with your existing tools like `psdelta.py`
|
|
209
|
+
4. Prepare for PyPI distribution
|
|
210
|
+
|
|
211
|
+
## Conclusion
|
|
212
|
+
|
|
213
|
+
This initial implementation provides a solid foundation for the UNCtools package. By following these testing instructions, you can verify that the package works correctly in your environment and identify any issues that need to be addressed before further development.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# UNCtools Implementation Summary
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
UNCtools is a comprehensive Python package for handling UNC paths, network drives, and substituted drives across different environments. It provides tools for path conversion, detection, and seamless file operations with proper handling of Windows-specific features.
|
|
6
|
+
|
|
7
|
+
## Implemented Components
|
|
8
|
+
|
|
9
|
+
### Core Modules
|
|
10
|
+
|
|
11
|
+
1. **`converter.py`**
|
|
12
|
+
- UNC ⇔ local path conversion
|
|
13
|
+
- Path normalization
|
|
14
|
+
- UNC path parsing and construction
|
|
15
|
+
|
|
16
|
+
2. **`detector.py`**
|
|
17
|
+
- Path type detection (UNC, network drive, subst drive)
|
|
18
|
+
- Network mapping discovery
|
|
19
|
+
- Path issue detection
|
|
20
|
+
|
|
21
|
+
3. **`operations.py`**
|
|
22
|
+
- Safe file operations
|
|
23
|
+
- Batch path conversion
|
|
24
|
+
- File processing utilities
|
|
25
|
+
|
|
26
|
+
### Windows-Specific Modules
|
|
27
|
+
|
|
28
|
+
1. **`windows/registry.py`**
|
|
29
|
+
- Windows security zone management
|
|
30
|
+
- Registry operations
|
|
31
|
+
|
|
32
|
+
2. **`windows/network.py`**
|
|
33
|
+
- Network drive mapping creation/removal
|
|
34
|
+
- Share management
|
|
35
|
+
- Network connection testing
|
|
36
|
+
|
|
37
|
+
### Package Infrastructure
|
|
38
|
+
|
|
39
|
+
1. **Package structure**
|
|
40
|
+
- Proper organization with sub-packages
|
|
41
|
+
- Clear separation of Windows-specific functionality
|
|
42
|
+
|
|
43
|
+
2. **Documentation**
|
|
44
|
+
- Comprehensive docstrings
|
|
45
|
+
- README with usage examples
|
|
46
|
+
- Example scripts
|
|
47
|
+
|
|
48
|
+
3. **Distribution**
|
|
49
|
+
- `setup.py` for pip installation
|
|
50
|
+
- `pyproject.toml` for modern packaging
|
|
51
|
+
- Optional dependencies
|
|
52
|
+
|
|
53
|
+
4. **Testing**
|
|
54
|
+
- Unit tests for core functionality
|
|
55
|
+
- Test infrastructure
|
|
56
|
+
|
|
57
|
+
## Key Features
|
|
58
|
+
|
|
59
|
+
1. **Path Conversion**
|
|
60
|
+
- Convert between UNC paths and mapped drive paths
|
|
61
|
+
- Support for multiple path formats
|
|
62
|
+
- Cross-platform compatible with graceful degradation
|
|
63
|
+
|
|
64
|
+
2. **Path Detection**
|
|
65
|
+
- Identify UNC paths, network drives, and substituted drives
|
|
66
|
+
- Determine path types and detect potential issues
|
|
67
|
+
- Windows-specific drive type detection
|
|
68
|
+
|
|
69
|
+
3. **File Operations**
|
|
70
|
+
- Safe file opening with automatic path conversion
|
|
71
|
+
- Batch file operations
|
|
72
|
+
- Path accessibility checks
|
|
73
|
+
|
|
74
|
+
4. **Windows Integration**
|
|
75
|
+
- Security zone management for UNC paths
|
|
76
|
+
- Network drive mapping and share administration
|
|
77
|
+
- Detailed logging and error handling
|
|
78
|
+
|
|
79
|
+
5. **Extensibility**
|
|
80
|
+
- Well-defined interfaces for future additions
|
|
81
|
+
- Modular design for optional components
|
|
82
|
+
- Fallback mechanisms when dependencies aren't available
|
|
83
|
+
|
|
84
|
+
## Next Steps
|
|
85
|
+
|
|
86
|
+
### Immediate Tasks
|
|
87
|
+
|
|
88
|
+
1. **Testing**
|
|
89
|
+
- Complete test suite for all modules
|
|
90
|
+
- Add integration tests that exercise real file system access
|
|
91
|
+
- Implement Windows-specific tests that can be conditionally skipped
|
|
92
|
+
|
|
93
|
+
2. **Documentation**
|
|
94
|
+
- Add more example scripts demonstrating different use cases
|
|
95
|
+
- Create detailed API documentation with Sphinx
|
|
96
|
+
- Add tutorials for common scenarios
|
|
97
|
+
|
|
98
|
+
3. **Edge Case Handling**
|
|
99
|
+
- Add more robust error handling for network failures
|
|
100
|
+
- Implement retry logic for transient issues
|
|
101
|
+
- Enhance logging with more detailed diagnostics
|
|
102
|
+
|
|
103
|
+
### Future Enhancements
|
|
104
|
+
|
|
105
|
+
1. **Extended Platform Support**
|
|
106
|
+
- Add better support for macOS network shares
|
|
107
|
+
- Implement Linux SMB/CIFS compatibility
|
|
108
|
+
- Support for other network file systems
|
|
109
|
+
|
|
110
|
+
2. **Advanced Windows Features**
|
|
111
|
+
- Support for Windows credential management
|
|
112
|
+
- Integration with admin privileges and UAC
|
|
113
|
+
- Advanced security and permission handling
|
|
114
|
+
|
|
115
|
+
3. **Performance Optimizations**
|
|
116
|
+
- Caching strategies for path conversions
|
|
117
|
+
- Lazy initialization for better startup time
|
|
118
|
+
- Parallel processing for batch operations
|
|
119
|
+
|
|
120
|
+
4. **Integration with Other Tools**
|
|
121
|
+
- File synchronization utilities
|
|
122
|
+
- Backup tools
|
|
123
|
+
- Development environment integrations
|
|
124
|
+
|
|
125
|
+
## Conclusion
|
|
126
|
+
|
|
127
|
+
The initial implementation of UNCtools provides a solid foundation for handling UNC paths and network drives across different environments. The modular design allows for easy extension and customization, while the cross-platform approach ensures usability beyond Windows environments.
|
|
128
|
+
|
|
129
|
+
The package addresses the core issues identified from previous tools like `psdelta.py`, `temp_renamer.py`, and `dazzlelink.py`, consolidating their UNC path handling capabilities into a single, reusable library with a clear API and comprehensive documentation.
|