summaryrefslogtreecommitdiffstats
path: root/bootstrap_dev.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bootstrap_dev.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/bootstrap_dev.py b/bootstrap_dev.py
new file mode 100644
index 0000000..e7cf3e1
--- /dev/null
+++ b/bootstrap_dev.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+
+# Symlink install flit & flit_core for development.
+# Most projects can do the same with 'flit install --symlink'.
+# But that doesn't work until Flit is installed, so we need some bootstrapping.
+
+import argparse
+import logging
+import os
+from pathlib import Path
+import sys
+
+my_dir = Path(__file__).parent
+os.chdir(str(my_dir))
+sys.path.insert(0, 'flit_core')
+
+from flit.install import Installer
+
+ap = argparse.ArgumentParser()
+ap.add_argument('--user')
+args = ap.parse_args()
+
+logging.basicConfig(level=logging.INFO)
+
+install_kwargs = {'symlink': True}
+if os.name == 'nt':
+ # Use .pth files instead of symlinking on Windows
+ install_kwargs = {'symlink': False, 'pth': True}
+
+# Install flit_core
+Installer.from_ini_path(
+ my_dir / 'flit_core' / 'pyproject.toml', user=args.user, **install_kwargs
+).install()
+print("Linked flit_core into site-packages.")
+
+# Install flit
+Installer.from_ini_path(
+ my_dir / 'pyproject.toml', user=args.user, **install_kwargs
+).install()
+print("Linked flit into site-packages.")