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='' installPdf=''
installInfo=' install-info' installInfo=' install-info'
installInfoInstall=' install-info-install' installInfoInstall=' install-info-install'
@ -73,6 +74,7 @@ for arg in "$@"; do
elif [ "$opt" = '--shell' ]; then elif [ "$opt" = '--shell' ]; then
SHELL="$val" SHELL="$val"
elif [ "$opt" = '--without-shared-cache' ]; then installCache=''
elif [ "$opt" = '--with-pdf' ]; then installPdf=' install-pdf' elif [ "$opt" = '--with-pdf' ]; then installPdf=' install-pdf'
elif [ "$opt" = '--without-info' ]; then installInfo='' elif [ "$opt" = '--without-info' ]; then installInfo=''
elif [ "$opt" = '--without-info-install' ]; then installInfoInstall='' elif [ "$opt" = '--without-info-install' ]; then installInfoInstall=''
@ -83,6 +85,7 @@ for arg in "$@"; do
elif [ "$opt" = '--without-zsh' ]; then installZsh='' elif [ "$opt" = '--without-zsh' ]; then installZsh=''
elif [ "$opt" = "--everything" ]; then elif [ "$opt" = "--everything" ]; then
installCache=' install-cache'
installPdf=' install-pdf' installPdf=' install-pdf'
installInfo=' install-info' installInfo=' install-info'
installInfoInstall=' install-info-install' installInfoInstall=' install-info-install'
@ -102,7 +105,7 @@ if [ "$installInfo" = '' ]; then
fi fi
compileMethods='core quotes manpages ponysaycompletion ponythinkcompletion' 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 if [ ! "$installInfo" = '' ]; then
compileMethods="$compileMethods infomanual" compileMethods="$compileMethods infomanual"
fi fi
@ -144,6 +147,7 @@ echo "PREFIX = $PREFIX, edit with option --prefix=PREFIX"
echo "INFODESC = $INFODESC, edit with option --info-desc=INFODESC" echo "INFODESC = $INFODESC, edit with option --info-desc=INFODESC"
echo "SHELL = $SHELL, edit with option --shell=PREFIX" echo "SHELL = $SHELL, edit with option --shell=PREFIX"
echo echo
[ ! "$installCache" = '' ] && echo "Installing shared cache, add option --without-shared-cache to skip"
[ ! "$installPdf" = '' ] && echo "Installing PDF manual" [ ! "$installPdf" = '' ] && echo "Installing PDF manual"
[ ! "$installInfo" = '' ] && echo "Installing info manual, add option --without-info to skip" [ ! "$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" [ ! "$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" [ ! "$installFish" = '' ] && echo "Installing autocompletion for fish, add option --without-fish to skip"
[ ! "$installZsh" = '' ] && echo "Installing autocompletion for zsh, add option --without-zsh to skip" [ ! "$installZsh" = '' ] && echo "Installing autocompletion for zsh, add option --without-zsh to skip"
echo echo
[ ! "$installCache" = '' ] || echo "Skipping shared cache"
[ ! "$installPdf" = '' ] || echo "Skipping PDF manual, add option --with-pdf to install" [ ! "$installPdf" = '' ] || echo "Skipping PDF manual, add option --with-pdf to install"
[ ! "$installInfo" = '' ] || echo "Skipping info manual" [ ! "$installInfo" = '' ] || echo "Skipping info manual"
[ ! "$installInfoInstall" = '' ] || echo "Skipping info manual installation with info-install" [ ! "$installInfoInstall" = '' ] || echo "Skipping info manual installation with info-install"
@ -232,6 +237,8 @@ function makeMakefile()
echo 'install "'"$file"'" "$(INSTALLDIR)/share/licenses/ponysay/'"$file"'"' echo 'install "'"$file"'" "$(INSTALLDIR)/share/licenses/ponysay/'"$file"'"'
done done
echo echo
echo 'install-cache:'
echo -en '\t' ; echo 'if [ -d "/var/cache/ponysay" ]; then rm -r "/var/cache/ponysay"; fi' 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 'mkdir -p "$(DESTDIR)/var/cache/ponysay/"'
echo -en '\t' ; echo 'chmod 777 "$(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 @cindex @command{zsh}, without
will skip installation of auto-completion for @command{ponysay} and the will skip installation of auto-completion for @command{ponysay} and the
shell @command{zsh}. 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 @end itemize
@cindex @command{--prefix=TARGET} @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}. add the option @command{--shell=SHELL}.
@node Arch Linux @node Arch Linux
@section Arch Linux @section Arch Linux
@cindex arch linux @cindex arch linux

10
ponysay
View file

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