-
Notifications
You must be signed in to change notification settings - Fork 117
Make PyWPS Windows friendly #594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cf0b381 to
9f9e073
Compare
|
Not sure why 3.6 failed and 3.7 got canceled... |
|
@cehbrecht Could you review please? |
Zeitsperre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Barring a few changes, looks good. I leave @cehbrecht to do the approval.
pywps/inout/basic.py
Outdated
| def uri_to_path(uri) -> str: | ||
| p = urlparse(uri) | ||
| path = p.path | ||
| if os.name == 'nt': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be enough to determine if the OS/Platform is actually Windows. I would leverage platform.system() for a few windows-like keys. See: https://stackoverflow.com/a/54837707/7322852
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be enough to determine if the OS/Platform is actually Windows. I would leverage
platform.system()for a few windows-like keys. See: https://stackoverflow.com/a/54837707/7322852
I looked at the post, I don't mind to follow your recommendation, but I couldn't find any system (windows-like or not) that have os.name != 'nt' and platform.system() == 'windows'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bring it up here since depending on the subsystem that the script is running in (msys2, cygwin, WSL2, etc.), this check might not return what we intend it to. There's also a possibility that the pathlib.Path function handles the file path changes in a better way (see: https://docs.python.org/3/library/pathlib.html#pathlib.PureWindowsPath) e.g.:
from pathlib import Path, PureWindowsPath, PurePosixPath
p = Path("D/path/to/a/file")
p.as_posix()
Out[5]: 'D/path/to/a/file'
str(PureWindowsPath(p))
Out[9]: 'D\\path\\to\\a\\file'
PurePosixPath(PureWindowsPath(p))
Out[15]: PurePosixPath('D/path/to/a/file')
To be fair, I haven't done much in Windows. Just presenting some options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing this up.
Actually I've used it here, but the only thing I couldn't figure out is how to get a proper WindowsPath from a file uri:
> p = r'c:\abc.txt'
> wp = WindowsPath(p)
> wp
WindowsPath('c:/abc.txt')
> wp.as_uri()
'file:///c:/abc.txt'
> from urllib.parse import urlparse
> parse = urlparse(uri)
> parse.path
'/c:/abc.txt'
> Path(parse.path)
WindowsPath('/c:/abc.txt')
How can I get rid of this leading slash without actually trimming it if ran on windows ?
17a517d to
9459f8f
Compare
Thanks for your review! |
|
PyWPS seems to be failing for Python3.6. Looking into this now. |
0214ee0 to
29c787c
Compare
|
Finally it's ready! |
ce1c93c to
040fe7e
Compare
|
I'm confused by the diff ... why is |
|
Oh! It's because the example process was originally in the docs and then was referred to within the |
As @Zeitsperre wrote, there was a symlink between the file at the docs to the source dir. |
cehbrecht
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only checked on linux ... it still works :)
|
@idanmiara @Zeitsperre I might use |
…etalinkprocess.py and update process.rst
done. |
|
@idanmiara It is but not because of you. The fix is quite simple if you want to add it. In Should be changed to: I don't think either of us has access to the GithHub action. @cehbrecht ? |
you can update it in this PR changing the workflow: |
Of course! I was looking at the |
done, now it works :) |
Overview
Resolved all the issues that prevented the tests to pass on Windows.
Contribution Agreement
(as per https://github.com/geopython/pywps/blob/master/CONTRIBUTING.rst#contributions-and-licensing)