mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
Merge pull request #321 from wting/install_to_usr_local_share
Installs to /usr/local/share instead of /etc/profile.d.
This commit is contained in:
commit
4f90d5b755
@ -59,7 +59,7 @@ from autojump_utils import sanitize
|
||||
from autojump_utils import take
|
||||
from autojump_utils import unico
|
||||
|
||||
VERSION = '22.0.2-beta'
|
||||
VERSION = '22.0.3-beta'
|
||||
FUZZY_MATCH_THRESHOLD = 0.6
|
||||
TAB_ENTRIES_COUNT = 9
|
||||
TAB_SEPARATOR = '__'
|
||||
|
@ -17,11 +17,11 @@ if [ "${shell}" = "sh" ]; then
|
||||
return 0
|
||||
|
||||
# check local install
|
||||
elif [ -s ~/.autojump/etc/profile.d/autojump.${shell} ]; then
|
||||
source ~/.autojump/etc/profile.d/autojump.${shell}
|
||||
elif [ -s ~/.autojump/share/autojump/autojump.${shell} ]; then
|
||||
source ~/.autojump/share/autojump/autojump.${shell}
|
||||
|
||||
# check global install
|
||||
elif [ -s /etc/profile.d/autojump.${shell} ]; then
|
||||
source /etc/profile.d/autojump.${shell}
|
||||
elif [ -s /usr/local/share/autojump/autojump.${shell} ]; then
|
||||
source /usr/local/share/autojump/autojump.${shell}
|
||||
|
||||
fi
|
||||
|
20
install.py
20
install.py
@ -136,12 +136,12 @@ def parse_arguments(): # noqa
|
||||
return args
|
||||
|
||||
|
||||
def print_post_installation_message(etc_dir, bin_dir):
|
||||
def print_post_installation_message(etc_dir, share_dir, bin_dir):
|
||||
if platform.system() == 'Windows':
|
||||
print("\nPlease manually add %s to your user path" % bin_dir)
|
||||
else:
|
||||
if get_shell() == 'fish':
|
||||
aj_shell = '%s/autojump.fish' % etc_dir
|
||||
aj_shell = '%s/autojump.fish' % share_dir
|
||||
source_msg = "if test -f %s; . %s; end" % (aj_shell, aj_shell)
|
||||
rcfile = '~/.config/fish/config.fish'
|
||||
else:
|
||||
@ -170,18 +170,19 @@ def main(args):
|
||||
bin_dir = os.path.join(args.destdir, args.prefix, 'bin')
|
||||
etc_dir = os.path.join(args.destdir, 'etc', 'profile.d')
|
||||
doc_dir = os.path.join(args.destdir, args.prefix, 'share', 'man', 'man1')
|
||||
icon_dir = os.path.join(args.destdir, args.prefix, 'share', 'autojump')
|
||||
share_dir = os.path.join(args.destdir, args.prefix, 'share', 'autojump')
|
||||
zshshare_dir = os.path.join(args.destdir, args.zshshare)
|
||||
|
||||
mkdir(bin_dir, args.dryrun)
|
||||
mkdir(doc_dir, args.dryrun)
|
||||
mkdir(icon_dir, args.dryrun)
|
||||
mkdir(etc_dir, args.dryrun)
|
||||
mkdir(share_dir, args.dryrun)
|
||||
|
||||
cp('./bin/autojump', bin_dir, args.dryrun)
|
||||
cp('./bin/autojump_argparse.py', bin_dir, args.dryrun)
|
||||
cp('./bin/autojump_data.py', bin_dir, args.dryrun)
|
||||
cp('./bin/autojump_utils.py', bin_dir, args.dryrun)
|
||||
cp('./bin/icon.png', icon_dir, args.dryrun)
|
||||
cp('./bin/icon.png', share_dir, args.dryrun)
|
||||
cp('./docs/autojump.1', doc_dir, args.dryrun)
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
@ -196,18 +197,19 @@ def main(args):
|
||||
modify_autojump_lua(args.clinkdir, bin_dir, args.dryrun)
|
||||
else:
|
||||
mkdir(etc_dir, args.dryrun)
|
||||
mkdir(share_dir, args.dryrun)
|
||||
mkdir(zshshare_dir, args.dryrun)
|
||||
|
||||
cp('./bin/autojump.sh', etc_dir, args.dryrun)
|
||||
cp('./bin/autojump.bash', etc_dir, args.dryrun)
|
||||
cp('./bin/autojump.fish', etc_dir, args.dryrun)
|
||||
cp('./bin/autojump.zsh', etc_dir, args.dryrun)
|
||||
cp('./bin/autojump.bash', share_dir, args.dryrun)
|
||||
cp('./bin/autojump.fish', share_dir, args.dryrun)
|
||||
cp('./bin/autojump.zsh', share_dir, args.dryrun)
|
||||
cp('./bin/_j', zshshare_dir, args.dryrun)
|
||||
|
||||
if args.custom_install:
|
||||
modify_autojump_sh(etc_dir, args.dryrun)
|
||||
|
||||
print_post_installation_message(etc_dir, bin_dir)
|
||||
print_post_installation_message(etc_dir, share_dir, bin_dir)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
36
uninstall.py
36
uninstall.py
@ -53,12 +53,12 @@ def remove_custom_installation(args, dryrun=False):
|
||||
return
|
||||
|
||||
bin_dir = os.path.join(args.destdir, args.prefix, 'bin')
|
||||
etc_dir = os.path.join(args.destdir, 'etc/profile.d')
|
||||
doc_dir = os.path.join(args.destdir, args.prefix, 'share/man/man1')
|
||||
icon_dir = os.path.join(args.destdir, args.prefix, 'share/autojump')
|
||||
doc_dir = os.path.join(args.destdir, args.prefix, 'share', 'man', 'man1')
|
||||
etc_dir = os.path.join(args.destdir, 'etc', 'profile.d')
|
||||
share_dir = os.path.join(args.destdir, args.prefix, 'share', 'autojump')
|
||||
zshshare_dir = os.path.join(args.destdir, args.zshshare)
|
||||
|
||||
if not os.path.exists(icon_dir):
|
||||
if not os.path.exists(share_dir):
|
||||
return
|
||||
|
||||
print("\nFound custom installation...")
|
||||
@ -76,12 +76,12 @@ def remove_custom_installation(args, dryrun=False):
|
||||
rm(os.path.join(bin_dir, 'jo.bat'), dryrun)
|
||||
else:
|
||||
rm(os.path.join(etc_dir, 'autojump.sh'), dryrun)
|
||||
rm(os.path.join(etc_dir, 'autojump.bash'), dryrun)
|
||||
rm(os.path.join(etc_dir, 'autojump.fish'), dryrun)
|
||||
rm(os.path.join(etc_dir, 'autojump.tcsh'), dryrun)
|
||||
rm(os.path.join(etc_dir, 'autojump.zsh'), dryrun)
|
||||
rm(os.path.join(share_dir, 'autojump.bash'), dryrun)
|
||||
rm(os.path.join(share_dir, 'autojump.fish'), dryrun)
|
||||
rm(os.path.join(share_dir, 'autojump.tcsh'), dryrun)
|
||||
rm(os.path.join(share_dir, 'autojump.zsh'), dryrun)
|
||||
rm(os.path.join(zshshare_dir, '_j'), dryrun)
|
||||
rmdir(icon_dir, dryrun)
|
||||
rmdir(share_dir, dryrun)
|
||||
rm(os.path.join(doc_dir, 'autojump.1'), dryrun)
|
||||
|
||||
if is_empty_dir(args.destdir):
|
||||
@ -94,12 +94,12 @@ def remove_system_installation(dryrun=False):
|
||||
default_zshshare = '/usr/share/zsh/site-functions'
|
||||
|
||||
bin_dir = os.path.join(default_destdir, default_prefix, 'bin')
|
||||
etc_dir = os.path.join(default_destdir, 'etc/profile.d')
|
||||
doc_dir = os.path.join(default_destdir, default_prefix, 'share/man/man1')
|
||||
icon_dir = os.path.join(default_destdir, default_prefix, 'share/autojump')
|
||||
doc_dir = os.path.join(default_destdir, default_prefix, 'share', 'man', 'man1')
|
||||
etc_dir = os.path.join(default_destdir, 'etc', 'profile.d')
|
||||
share_dir = os.path.join(default_destdir, default_prefix, 'share', 'autojump')
|
||||
zshshare_dir = os.path.join(default_destdir, default_zshshare)
|
||||
|
||||
if not os.path.exists(icon_dir):
|
||||
if not os.path.exists(share_dir):
|
||||
return
|
||||
|
||||
print("\nFound system installation...")
|
||||
@ -113,12 +113,12 @@ def remove_system_installation(dryrun=False):
|
||||
rm(os.path.join(bin_dir, 'autojump_data.py'), dryrun)
|
||||
rm(os.path.join(bin_dir, 'autojump_utils.py'), dryrun)
|
||||
rm(os.path.join(etc_dir, 'autojump.sh'), dryrun)
|
||||
rm(os.path.join(etc_dir, 'autojump.bash'), dryrun)
|
||||
rm(os.path.join(etc_dir, 'autojump.fish'), dryrun)
|
||||
rm(os.path.join(etc_dir, 'autojump.tcsh'), dryrun)
|
||||
rm(os.path.join(etc_dir, 'autojump.zsh'), dryrun)
|
||||
rm(os.path.join(share_dir, 'autojump.bash'), dryrun)
|
||||
rm(os.path.join(share_dir, 'autojump.fish'), dryrun)
|
||||
rm(os.path.join(share_dir, 'autojump.tcsh'), dryrun)
|
||||
rm(os.path.join(share_dir, 'autojump.zsh'), dryrun)
|
||||
rm(os.path.join(zshshare_dir, '_j'), dryrun)
|
||||
rmdir(icon_dir, dryrun)
|
||||
rmdir(share_dir, dryrun)
|
||||
rm(os.path.join(doc_dir, 'autojump.1'), dryrun)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user