Mercurial > hg > config
changeset 694:ebca6d85213a
File "/usr/lib/python3/dist-packages/IPython/config/__init__.py", line 16, in <module>
from .application import *
File "/usr/lib/python3/dist-packages/IPython/config/application.py", line 31, in <module>
from IPython.config.configurable import SingletonConfigurable
File "/usr/lib/python3/dist-packages/IPython/config/configurable.py", line 33, in <module>
from IPython.utils.text import indent, wrap_paragraphs
File "/usr/lib/python3/dist-packages/IPython/utils/text.py", line 28, in <module>
from IPython.external.path import path
File "/usr/lib/python3/dist-packages/IPython/external/path/__init__.py", line 2, in <module>
from path import *
File "/home/jhammel/python/path.py", line 25
print root(path)
^
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Wed, 09 Jul 2014 16:26:49 -0700 |
parents | c7309e7625ba |
children | 9d3b030696fa |
files | .config/user-dirs.dirs python/_path.py python/path.py |
diffstat | 3 files changed, 26 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/.config/user-dirs.dirs Wed Jul 02 10:50:04 2014 -0700 +++ b/.config/user-dirs.dirs Wed Jul 09 16:26:49 2014 -0700 @@ -10,6 +10,6 @@ XDG_TEMPLATES_DIR="$HOME/" XDG_PUBLICSHARE_DIR="$HOME/" XDG_DOCUMENTS_DIR="$HOME/docs/" -XDG_MUSIC_DIR="$HOME/music" +XDG_MUSIC_DIR="$HOME/" XDG_PICTURES_DIR="$HOME/image/" XDG_VIDEOS_DIR="$HOME/movies/"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/_path.py Wed Jul 09 16:26:49 2014 -0700 @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +""" +(filesystem) path utilities + +from http://stackoverflow.com/questions/12041525/a-system-independent-way-using-python-to-get-the-root-directory-drive-on-which-p +""" + +import os + +def is_root(path): + """is `path` the filesystem root""" + return not os.path.split(path)[1] + +def root(path): + """return filesystem root of path""" + path = os.path.abspath(path) + while not is_root(path): + path, tail = os.path.split(path) + return path + +if __name__ == '__main__': + import sys + for path in sys.argv[1:]: + print root(path)
--- a/python/path.py Wed Jul 02 10:50:04 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#!/usr/bin/env python - -""" -(filesystem) path utilities - -from http://stackoverflow.com/questions/12041525/a-system-independent-way-using-python-to-get-the-root-directory-drive-on-which-p -""" - -import os - -def is_root(path): - """is `path` the filesystem root""" - return not os.path.split(path)[1] - -def root(path): - """return filesystem root of path""" - path = os.path.abspath(path) - while not is_root(path): - path, tail = os.path.split(path) - return path - -if __name__ == '__main__': - import sys - for path in sys.argv[1:]: - print root(path)