-
Notifications
You must be signed in to change notification settings - Fork 98
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 fixes #17
Linux fixes #17
Conversation
…ate#16) Bump version to 1.3.0
Conflicts: lib/appdirs.py
Is there a reason that these fixes are not being merged? Is this project abandoned? If that's the case, are you planning on maintaining your fork, @eddyp? |
we have just been busy with stackato work. i will take a look at the pull requests this weekend. |
Great; thanks for checking it out, @srid. |
Simon, thanks for your interest in my changes and the heads-up for the maintainers. I suspect now that there won't be a need for me to maintain a fork :-) @srid : please note that on my master branch I have also merged all of @joeyespo 's pull requests which have fixes for issues #14, #11 (pull request #13) and #12. This should make your merge related work easier and reduced to a simple review of the code. |
@srid: BTW, I think appdirs should also have some supplemental APIs for user and system config information dirs which are treated differently on *nix, and I think this is the reason why you thought there was some confusion in the spec. The reason for the confusion was probably because you tried to fit two types of different information in the single hole of 'data' information, kind of like trying to fit a square peg into a round hole. |
I can do it, no problems. But it's not clear to me on which branch I should focus. Also, do you agree with me there should be user_config_dir and site_config_dir or something of that sort? |
Conflicts: lib/appdirs.py
Conflicts: lib/appdirs.py
@srid: I added the *_config_dir stuff, too. (Sorry for the accidental close) |
@eddyp i plan to merge your 'master' branch and close the related pull requests. but before i do that, i need to verify the changes using tests. new features will need new tests as well. (anyone want to volunteer for adding travis-ci support?)
yup, actually having those functions becomes important in light of the XDG change. |
@srid: the *_config_dir changes are already done. Could you, please, check them? The update in the Readme are mostly copy + paste. I think some manual tests should be enough for now, until the test frame matures and the details are ironed out. Talking about formal tests at this stage is probably premature. |
@eddyp sorry, what's the question? Couple of thoughts though:
BTW, I would emphasize the word ‘lightweight’ … that is one more reason for me to make the library free of any external dependencies. |
@mcepl: see issue #19 for the question. Is basically allowing one to test correct values are returned for all platforms while running the tests on any given OS (supported or not). Regarding the rebase, I just checked locally, merging the current master into my master is trivial, but the CHANGES.rst file was not updated after the cleaned up test frame, not was the version information bumped, so I am waiting for those changes and some proof of concept tests to test the actual values returned. |
Concerning |
AIUI, that file is for end users, and due to people like myself preferring atomic/small commit chunks, such a log would be useless for end users and would have to be filtered. Still, dropping the file is @srid's decision. |
@@ -216,11 +320,13 @@ def user_log_dir(appname, appauthor=None, version=None, opinion=True): | |||
|
|||
class AppDirs(object): | |||
"""Convenience wrapper for getting application dirs.""" | |||
def __init__(self, appname, appauthor, version=None, roaming=False): | |||
def __init__(self, appname, appauthor=None, version=None, | |||
roaming=False, returnlist=False): |
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.
having to pass the return data type of a bunch of methods in the class initializer seems strange to me. how about providing alternative functions for returning multiple values? for example: site_config_dir
vs site_config_dirs
(note the plural form)
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.
The type of the data doesn't change at all. It is always a string. The difference is that is a string containing mutiple paths separated by os.sep, as the XDG standard requires.
Do you think another name like 'multivalue' or 'firstonly' would have been a better name?
(note that with 'firstonly' the logic must be inverted)
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 see. returnlist
returns multiple paths as a single string separated by os.pathsep
. is there a reason why it is not returning an actual list of paths? i'm not sure what the use case of returning multiple paths is; i'm guessing that users want to search for files -- say themes/plugins in /usr/share, ~/.local/share, etc -- in each and every paths, in which case they would probably use it as ,
for path in user_config_dir(returnlist=True).split(os.path)
as the XDG standard requires
keep in mind that appdirs API -- function arguments, return value format/type, etc. -- should ideally not be tied in to platform-specific concerns.
Do you think another name like 'multivalue' or 'firstonly' would have been a better name?
was it that use case (my guess above) that you had in mind when implementing the returnlist feature? if so, i find the following to be more straightforward:
for path in user_config_dir(returnlist=True):
even better, as the function name is currently in singular form:
# note the _list prefix, which is probably better than adding a single "s" to the function name
for path in user_config_dir_list():
explicit is better than implicit. :-)
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.
is there a reason why it is not returning an actual list of paths?
I did not want to have the function return sometimes a string and other times a list of strings. I don't consider it a sane practice to have a function return an unknown type, it can break applications very badly. Keeping it a string means the same type, string, is the return type.
i'm not sure what the use case of returning multiple paths is; i'm guessing that users want to search for file
Yes, this is correct. Please note that the XDG standard states there are site specific data dirs $XDG_DATA_DIRS
and site specific config dirs $XDG_CONFIG_DIRS
, but there is only a user specific data dir $XDG_DATA_HOME
and a user specific config dir $XDG_CONFIG_HOME
.
appdirs API -- should ideally not be tied in to platform-specific concerns.
That's why I tried to keep it backwards compatible, and for *_config_dir APIs on Windows and Mac I returned the *_data_dir information.
Even if we opt for site_*_dir_list APIs for multivalues, the API will be useful for *nix and the other two will only wrap the site_data_dir and we'll effectively have 4 APIs which essentially are identical due to wrapping and due to lack of dir lists. Please take this into account, too.
I think I prefer the site_config_dir_list variant as a disambiguation, although the site_config_dir API will probably remain unused on *nix and on Windows and Mac site_config_dir, site_data_dir, site_config_dir_litst and site_data_dir_list
are essentially identical.
I am saying on *nix it will remain unused because, usually, applications DO want to search for files in /usr/local/share
, then, if not found, in /usr/share
. The order is significant and the mechanism is a fallback type of mechanism.
What do you think?
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.
hmm, thinking about it - adding a couple of extra functions that won't be used on win/mac doesn't appeal to me. actually, it looks like returning "multipath" (paths separated by os.pathsep) is already a good workaround. this is what you already have.
though, can we rename returnlist
to multiple
? as in:
site_data_dir(multiple=True) => "/usr/local/share:/usr/share"
mostly because it is not really returning a list date type.
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 agree with the rename.
How about multivalue
or mutipath
? mutiple
has mathematical co-notations, which might be confusing (at least it does for me and it could be confusing).
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.
+1 for multipath
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.
Should I do the changes on my master and we'll ignore linux-fixes from now on?
I can create a 'next' branch based on my master with the current official master merged in, it you want.
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.
On Tue, Mar 19, 2013 at 1:55 PM, eddyp notifications@github.com wrote:
Should I do the changes on my master and we'll ignore linux-fixes from now
on?
I can create a 'next' branch based on my master with the current official
master merged in, it you want.
sure, 'next' works.
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.
next added
https://github.com/eddyp/appdirs/tree/next
(sorry, I can't find the correct syntax to link correctly the branch)
done ... and commented on the changes as well.
correct. |
@srid: do you have any other comments regarding the code ? I have replied to your comment regarding the startswith/in code and opened a new issue to deal with all such occurrences. The returnlist -> multipath change is implemented. The current ActiveState/master is merged in my eddyp/next branch. So I am waiting for your input or the actual merge. |
@eddyp - i'm looking into your branch in origin/eddy, so far: on linux
on mac
do you have a windows machine to check the output? |
n/m .. i've merged it to master now. but we will need proper tests (issue #19) before cutting a release to pypi. closing this issue now, thanks for the work. |
I removed my linux-fixes branch since, in the end, 'next' was merged instead. |
Fixes Issue #16
Bumps version to 1.3.0
Removes gratuitous case mangling on the case-sensitive Linux, since that's not wise
Fixes the uterly wrong behaviour in site_data_dir, return result based on XDG_DATA_DIRS and make room for respecting the standard which specifies XDG_DATA_DIRS is a multiple-value variable
Add *_config_dir which are distinct on nix-es, according to XDG specs; on Windows and Mac return the corresponding *_data_dir (Fixes Issue #6)