[go: up one dir, main page]

File: bootstrap_dev.py

package info (click to toggle)
flit 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,080 kB
  • sloc: python: 3,934; makefile: 161; sh: 16
file content (48 lines) | stat: -rw-r--r-- 1,323 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/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_core import build_thyself
from flit_core.config import LoadedConfig
from flit.install import Installer

ap = argparse.ArgumentParser()
ap.add_argument('--user')
args = ap.parse_args()

logging.basicConfig(level=logging.INFO)

# Construct config for flit_core
core_config = LoadedConfig()
core_config.module = 'flit_core'
core_config.metadata = build_thyself.metadata_dict
core_config.reqs_by_extra['.none'] = build_thyself.metadata.requires_dist

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(
    my_dir / 'flit_core', core_config, 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.")