1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

add --force option back

This commit is contained in:
William Ting 2013-12-31 10:48:24 -06:00
parent 8ab23c01c4
commit c15996db19
2 changed files with 16 additions and 12 deletions

View File

@ -8,7 +8,6 @@
- `--auto` option removed
- `--local` option removed, defaults to local user install
- `--global` option renamed to `--system`
- `--force` option removed
- install.py modifies autojump.sh accordingly for custom installations
- it is recommended that maintainers use install.py with `--destdir` and
`--prefix` accordingly. Two stage installations requires manually updating

View File

@ -55,6 +55,9 @@ def parse_arguments():
parser.add_argument(
'-n', '--dryrun', action="store_true", default=False,
help='simulate installation')
parser.add_argument(
'-f', '--force', action="store_true", default=False,
help='skip root user, shell type, Python version checks')
parser.add_argument(
'-d', '--destdir', metavar='DIR', default=default_user_destdir,
help='set destination to DIR')
@ -70,13 +73,20 @@ def parse_arguments():
args = parser.parse_args()
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
print("Python v2.7+ or v3.0+ required.", file=sys.stderr)
sys.exit(1)
if not args.force:
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
print("Python v2.7+ or v3.0+ required.", file=sys.stderr)
sys.exit(1)
if get_shell() not in SUPPORTED_SHELLS:
print("Unsupported shell: %s" % os.getenv('SHELL'), file=sys.stderr)
sys.exit(1)
if get_shell() not in SUPPORTED_SHELLS:
print("Unsupported shell: %s" % os.getenv('SHELL'),
file=sys.stderr)
sys.exit(1)
if args.system and os.geteuid() != 0:
print("Please rerun as root for system-wide installation.",
file=sys.stderr)
sys.exit(1)
if args.destdir != default_user_destdir \
or args.prefix != default_user_prefix \
@ -86,11 +96,6 @@ def parse_arguments():
args.custom_install = False
if args.system:
if os.geteuid() != 0:
print("Please rerun as root for system-wide installation.",
file=sys.stderr)
sys.exit(1)
if args.custom_install:
print("Custom paths incompatible with --system option.",
file=sys.stderr)