-
Notifications
You must be signed in to change notification settings - Fork 473
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
[Linux] Source configuration/data from standard locations #792
Comments
Here's a hacky example that is currently applied to the Arch Linux AUR package: --- src/var.py 2018-08-03 14:30:31.000000000 -0600
+++ src/var.py 2018-08-11 12:02:27.184546770 -0600
@@ -20,6 +20,18 @@
GAM_LATEST_RELEASE = GAM_ALL_RELEASES+u'/latest'
GAM_PROJECT_APIS = u'https://raw.githubusercontent.com/jay0lee/GAM/master/src/project-apis.txt'
+try:
+ XDG_CONFIG_DIR = os.environ['XDG_CONFIG_HOME']
+except KeyError:
+ XDG_CONFIG_DIR = os.path.expanduser("~") + '/.config/'
+CONFIG_DIR = unicode(XDG_CONFIG_DIR) + u'gam/'
+
+try:
+ os.makedirs(CONFIG_DIR, mode=0700)
+except OSError:
+ if not os.path.isdir(CONFIG_DIR):
+ raise
+
TRUE = u'true'
FALSE = u'false'
true_values = [u'on', u'yes', u'enabled', u'true', u'1'] |
@ainola is it worth submitting this as a patch to see if it'll be merged in? |
The hack certainly is better than nothing for the AUR package but I'm afraid larger-scale changes need to happen before this gets merged in. For one, the logic for saving the token is broken IIRC and one needs to generate it with the incumbent method and move the tokens manually. I think GAM needs to adopt the mentality of a system package rather than standalone; Now that there's an effort underway to clean up the codebase it very well may be worth our time to standardize locations (XDG directories for Linux, Library for mac, etc). |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This is absolutely still relevant. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
My attempt to revive this package and make it work. The upstram project author focuses mainly on binary distribution. The biggest problem imho in packing this is storing credentials in users config dir and NOT in gam.py folder. Previous maintaner tried to bring the issue (GAM-team/GAM#792), but nobody seems to be bothered to do something about it. The xdg_config_dirs.patch works good enough for me to try maintaning this package.
GAM7 now supports storing config in a folder specified by the GAMCFGDIR env variable. PTAL and see if this solves this issue. |
Presently, GAM uses its own directory structure; however if one wants to package this application for system installation, GAM will not (and should not) have access to alter its installation directories. GAM should be looking in standard Linux configuration directories:
$XDG_CONFIG_HOME/gam/<configfile>
if available, then/etc/gam/<configfile>
for the system defaults. Individual user tokens should be sourced from$XDG_CONFIG_HOME/gam/<tokenfile>
(and the program should refuse to work if the token is world-readable).These changes would allow packaging into Archlinux for users to install.
The text was updated successfully, but these errors were encountered: