-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
36 lines (31 loc) · 936 Bytes
/
__init__.py
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 __future__ import annotations
import numpy as np
try:
from .cysend import *
except Exception as e:
import Cython, setuptools, platform, subprocess, os, sys, time, exceptdrucker, numpy,regex
iswindows = "win" in platform.platform().lower()
if iswindows:
addtolist = []
else:
addtolist = ["&"]
olddict = os.getcwd()
dirname = os.path.dirname(__file__)
os.chdir(dirname)
compile_file = os.path.join(dirname, "cysend_compile.py")
subprocess._USE_VFORK = False
subprocess._USE_POSIX_SPAWN = False
subprocess.run(
" ".join([sys.executable, compile_file, "build_ext", "--inplace"] + addtolist),
shell=True,
env=os.environ,
preexec_fn=None
if iswindows
else os.setpgrp
if hasattr(os, "setpgrp")
else None,
)
if not iswindows:
time.sleep(120)
from .cysend import *
os.chdir(olddict)