Skip to content

Commit

Permalink
Merge pull request #571 from nanonyme/nanonyme/bootstrap-prefix
Browse files Browse the repository at this point in the history
Support optional installation root
  • Loading branch information
takluyver committed Aug 2, 2022
2 parents 3ca7540 + 3d05384 commit 5270ab2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions flit_core/bootstrap_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,21 @@ def extract_wheel(whl_path, dest):
default=purelib,
help=f'installdir directory (defaults to {purelib})',
)
parser.add_argument(
'--install-root',
type=Path,
default=None,
help='if given, installdir is considered to be under this'
)

args = parser.parse_args()

if not args.wheel.name.startswith('flit_core-'):
sys.exit("Use this script only for flit_core wheels")
if not args.installdir.is_dir():
sys.exit(f"{args.installdir} is not a directory")
if args.install_root:
installdir = args.install_root / args.installdir.relative_to("/")
else:
installdir = args.installdir

extract_wheel(args.wheel, args.installdir)
installdir.mkdir(parents=True, exist_ok=True)
extract_wheel(args.wheel, installdir)

0 comments on commit 5270ab2

Please sign in to comment.