-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
36 lines (30 loc) · 764 Bytes
/
tasks.py
File metadata and controls
36 lines (30 loc) · 764 Bytes
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
from invoke import task, run
import os
import sys
@task
def build(c):
run("python -m build")
@task
def install(c):
run("pip install . --force-reinstall")
@task
def setup(c):
run("pip install build")
build(c)
install(c)
@task
def publish(c):
c.run("poetry build")
c.run("poetry publish")
@task
def run_all(c):
setup(c)
# 设置 PYTHONPATH 环境变量
os.environ['PYTHONPATH'] = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))
print("Python 路径:", os.environ['PYTHONPATH'])
run("pytest")
publish(c)
if __name__ == "__main__":
import sys
program = Program(namespace=Collection(build, install, setup, publish, run_all))
sys.exit(program.run())