Compare commits

...

7 Commits

Author SHA1 Message Date
I-Al-Istannen
cccd68e04a Bump version to v2.6.2 2021-04-29 00:18:26 +02:00
I-Al-Istannen
2bd40a5f30 Fix -p and -u flags 2021-04-29 00:17:51 +02:00
I-Al-Istannen
2ca1101326 Fix typo in sync_url 2021-04-19 14:53:16 +02:00
I-Al-Istannen
c1ab7485e2 Bump version to 2.6.1 2021-04-19 11:21:56 +02:00
I-Al-Istannen
29cd5d1a3c Reflect totality of sanitize_windows_path in return type 2021-04-19 11:10:02 +02:00
I-Al-Istannen
6d5d9333ad Force folder to be file-system path 2021-04-19 11:07:25 +02:00
I-Al-Istannen
7cc40595dc Allow synchronizing to directory "." 2021-04-14 20:25:25 +02:00
4 changed files with 16 additions and 14 deletions

View File

@@ -130,7 +130,7 @@ def re_rename(regex: Regex, target: str) -> Transform:
return inner
def sanitize_windows_path(path: PurePath) -> Optional[PurePath]:
def sanitize_windows_path(path: PurePath) -> PurePath:
"""
A small function to escape characters that are forbidden in windows path names.
This method is a no-op on other operating systems.

View File

@@ -37,7 +37,7 @@ Ensure that you have at least Python 3.8 installed.
To install PFERD or update your installation to the latest version, run this
wherever you want to install or have already installed PFERD:
```
$ pip install git+https://github.com/Garmelon/PFERD@v2.6.0
$ pip install git+https://github.com/Garmelon/PFERD@v2.6.2
```
The use of [venv] is recommended.
@@ -60,8 +60,8 @@ $ mkdir Vorlesungen
$ cd Vorlesungen
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install git+https://github.com/Garmelon/PFERD@v2.6.0
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.6.0/example_config.py
$ pip install git+https://github.com/Garmelon/PFERD@v2.6.2
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.6.2/example_config.py
$ python3 example_config.py
$ deactivate
```

View File

@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
setup(
name="PFERD",
version="2.6.0",
version="2.6.2",
packages=find_packages(),
install_requires=[
"requests>=2.21.0",

View File

@@ -26,9 +26,10 @@ _LOGGER = logging.getLogger("sync_url")
_PRETTY = PrettyLogger(_LOGGER)
def _extract_credentials(file_path: Optional[str]) -> UserPassAuthenticator:
def _extract_credentials(file_path: Optional[str],
username: Optional[str], password: Optional[str]) -> UserPassAuthenticator:
if not file_path:
return UserPassAuthenticator("KIT ILIAS Shibboleth", None, None)
return UserPassAuthenticator("KIT ILIAS Shibboleth", username, password)
if not Path(file_path).exists():
_PRETTY.error("Credential file does not exist")
@@ -96,7 +97,7 @@ def main() -> None:
"KIT ILIAS Shibboleth", username=args.username, password=args.password
)
else:
inner_auth = _extract_credentials(args.credential_file)
inner_auth = _extract_credentials(args.credential_file, args.username, args.password)
username, password = inner_auth.get_credentials()
authenticator = KitShibbolethAuthenticator(inner_auth)
@@ -121,7 +122,8 @@ def main() -> None:
# files may not escape the pferd_root with relative paths
# note: Path(Path.cwd, Path(folder)) == Path(folder) if it is an absolute path
pferd_root = Path(Path.cwd(), Path(folder)).parent
target = folder.name
# Folder might be a *PurePath* at this point
target = Path(folder).resolve().name
pferd = Pferd(pferd_root, test_run=args.test_run)
def dir_filter(_: Path, element: IliasElementType) -> bool:
@@ -130,13 +132,13 @@ def main() -> None:
return True
if args.local_first:
file_confilict_resolver: FileConflictResolver = _resolve_local_first
file_conflict_resolver: FileConflictResolver = _resolve_local_first
elif args.no_delete:
file_confilict_resolver = _resolve_no_delete
file_conflict_resolver = _resolve_no_delete
elif args.remote_first:
file_confilict_resolver = _resolve_remote_first
file_conflict_resolver = _resolve_remote_first
else:
file_confilict_resolver = resolve_prompt_user
file_conflict_resolver = resolve_prompt_user
pferd.enable_logging()
@@ -148,7 +150,7 @@ def main() -> None:
dir_filter=dir_filter,
username=username,
password=password,
file_conflict_resolver=file_confilict_resolver,
file_conflict_resolver=file_conflict_resolver,
transform=sanitize_windows_path
)