summaryrefslogtreecommitdiffstats
path: root/bootstrap_dev.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:26:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:26:28 +0000
commitbbbeb2d07d4f7fd0191032c219b40565fd83454f (patch)
tree3c08f1e09ed89a004867762ab40f3b610f6c0fa1 /bootstrap_dev.py
parentInitial commit. (diff)
downloadflit-fb964a2087b349369fbf3451e9b410ec7ec10019.tar.xz
flit-fb964a2087b349369fbf3451e9b410ec7ec10019.zip
Adding upstream version 3.8.0.upstream/3.8.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bootstrap_dev.py')
-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.")