private cache

This commit is contained in:
Mattias Andrée 2012-08-20 18:53:00 +02:00
parent 22963aebbc
commit 908616bcea
3 changed files with 23 additions and 3 deletions

9
configure vendored
View file

@ -53,6 +53,7 @@ function getcompfile()
installCache=' install-cache'
installPdf=''
installInfo=' install-info'
installInfoInstall=' install-info-install'
@ -73,6 +74,7 @@ for arg in "$@"; do
elif [ "$opt" = '--shell' ]; then
SHELL="$val"
elif [ "$opt" = '--without-shared-cache' ]; then installCache=''
elif [ "$opt" = '--with-pdf' ]; then installPdf=' install-pdf'
elif [ "$opt" = '--without-info' ]; then installInfo=''
elif [ "$opt" = '--without-info-install' ]; then installInfoInstall=''
@ -83,6 +85,7 @@ for arg in "$@"; do
elif [ "$opt" = '--without-zsh' ]; then installZsh=''
elif [ "$opt" = "--everything" ]; then
installCache=' install-cache'
installPdf=' install-pdf'
installInfo=' install-info'
installInfoInstall=' install-info-install'
@ -102,7 +105,7 @@ if [ "$installInfo" = '' ]; then
fi
compileMethods='core quotes manpages ponysaycompletion ponythinkcompletion'
installMethods='install-min'"$installPdf$installInfo$installInfoInstall$installMan$installManEs$installBash$installFish$installZsh"
installMethods='install-min'"$installCache$installPdf$installInfo$installInfoInstall$installMan$installManEs$installBash$installFish$installZsh"
if [ ! "$installInfo" = '' ]; then
compileMethods="$compileMethods infomanual"
fi
@ -144,6 +147,7 @@ echo "PREFIX = $PREFIX, edit with option --prefix=PREFIX"
echo "INFODESC = $INFODESC, edit with option --info-desc=INFODESC"
echo "SHELL = $SHELL, edit with option --shell=PREFIX"
echo
[ ! "$installCache" = '' ] && echo "Installing shared cache, add option --without-shared-cache to skip"
[ ! "$installPdf" = '' ] && echo "Installing PDF manual"
[ ! "$installInfo" = '' ] && echo "Installing info manual, add option --without-info to skip"
[ ! "$installInfoInstall" = '' ] && echo "Installing info manual with info-install, add option --without-info to skip"
@ -153,6 +157,7 @@ echo
[ ! "$installFish" = '' ] && echo "Installing autocompletion for fish, add option --without-fish to skip"
[ ! "$installZsh" = '' ] && echo "Installing autocompletion for zsh, add option --without-zsh to skip"
echo
[ ! "$installCache" = '' ] || echo "Skipping shared cache"
[ ! "$installPdf" = '' ] || echo "Skipping PDF manual, add option --with-pdf to install"
[ ! "$installInfo" = '' ] || echo "Skipping info manual"
[ ! "$installInfoInstall" = '' ] || echo "Skipping info manual installation with info-install"
@ -232,6 +237,8 @@ function makeMakefile()
echo 'install "'"$file"'" "$(INSTALLDIR)/share/licenses/ponysay/'"$file"'"'
done
echo
echo 'install-cache:'
echo -en '\t' ; echo 'if [ -d "/var/cache/ponysay" ]; then rm -r "/var/cache/ponysay"; fi'
echo -en '\t' ; echo 'mkdir -p "$(DESTDIR)/var/cache/ponysay/"'
echo -en '\t' ; echo 'chmod 777 "$(DESTDIR)/var/cache/ponysay/"'

View file

@ -651,6 +651,12 @@ Friendly interactive shell, @command{fish}.
@cindex @command{zsh}, without
will skip installation of auto-completion for @command{ponysay} and the
shell @command{zsh}.
@item @command{--without-shared-cache}
@cindex @command{--without-shared-cache}
@cindex cache
@cindex kms
will skip installing a shared cache for KMS support, when there is no
shared cache, private one will be used at @code{~/.cache/ponysay}.
@end itemize
@cindex @command{--prefix=TARGET}
@ -672,6 +678,7 @@ By default @command{bash} is in the make file, if you want to use another shell
add the option @command{--shell=SHELL}.
@node Arch Linux
@section Arch Linux
@cindex arch linux

10
ponysay
View file

@ -452,11 +452,17 @@ class Ponysay():
palette = env_kms
palettefile = env_kms.replace('\033]P', '')
kmsponies = '/var/cache/ponysay/kmsponies/' + palettefile
cachedir = '/var/cache/ponysay'
if not os.path.isdir(cachedir):
cachedir = HOME + '/.cache/ponysay'
if not os.path.isdir(cachedir):
os.makedirs(cachedir)
kmsponies = cachedir + '/kmsponies/' + palettefile
kmspony = (kmsponies + pony).replace('//', '/')
if not os.path.isfile(kmspony):
protokmsponies = '/var/cache/ponysay/protokmsponies/'
protokmsponies = cachedir + '/protokmsponies/'
protokmspony = (protokmsponies + pony).replace('//', '/')
protokmsponydir = protokmspony[:protokmspony.rindex('/')]