-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix path issues w/setup.py #11
base: master
Are you sure you want to change the base?
Conversation
One cannot assume that /etc is writable in setup.py as doing so breaks installs w/o root permissions; moved config to user only, copy sample config file to config directory if it doesn't exist; update config to provide suggestions for additional languages; Also, change default URL to use TLS/HTTPS
I also just noticed that this might fix issue #6 ... since setup.py now uses (for lack of a better term) "automatic" paths, it should be more cross-platform friendly. There might be a few more issues to get everything working on windows... haven't had a chance to test there yet. |
from wikicurses import formats | ||
from urllib.parse import urlparse | ||
|
||
default_configdir = os.environ['HOME'] + '/.config' | ||
# TODO: This may cause issues with python 2.7; however, as of 01OCT2019, it is nearing sunset |
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.
Running Wikicurses in Python 2 already fails immediately (syntax errors from yield from
, which was added later). So that shouldn't be a problem.
(I personally don't see any reason now to support Python 2 in an application; maybe in a library.)
|
||
os.makedirs(configpath, exist_ok=True) | ||
|
||
if not os.path.isfile(configfile): |
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.
Neat solution!
One thing I'm not so sure about: I think the current behavior using a global configuration file instead of copying like this might be better for disro packaging (rather than installing with pip
). Arch Linux, at least, currently packages Wikicurses.
But then, maybe it would just complicate and confuse things too much to provide a mechanism for either copying or not copying...
I guess if we want this complexity, it might be best achieved by also checking for /etc/wikicurses.conf
, and not copying the configuration if that exists.
files_spec = [ | ||
('share/wikicurses', ['conf/wikicurses.conf.dist']), | ||
('share/zsh/site-functions', ['zsh/_wikicurses']), | ||
('share/man/man1', ['docs/wikicurses.1']), |
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.
Hm. Unfortunately man
doesn't seem to check ~/.local/share/main
by default, at least on Arch Linux. But I presume there's no better solution for user-local installs...
Summary
Just a few updates -- mostly to do with the fact that wikicurses wouldn't install on termux with a standard "pip install wikicurses". This had to do with the way that setup.py was trying to write to an absolute path (i.e. /etc/wikicurses.conf).
Commit Summary
One cannot assume that /etc is writable in setup.py as doing so breaks
installs w/o root permissions; moved config to user only, copy sample
config file to config directory if it doesn't exist; update config
to provide suggestions for additional languages;
Also, change default URL to use TLS/HTTPS