add pip_publish

This commit is contained in:
Dun Liang 2021-10-12 14:28:57 +08:00
parent e0d046f449
commit 030b30727d
3 changed files with 35 additions and 4 deletions

View File

@ -9,7 +9,7 @@
# file 'LICENSE.txt', which is part of this source code package.
# ***************************************************************
__version__ = '1.3.0.12'
__version__ = '1.3.0.14'
from jittor_utils import lock
with lock.lock_scope():
ori_int = int

View File

@ -0,0 +1,34 @@
import os
import glob
import shutil
import sys
home_path = os.path.join(os.path.dirname(__file__), "..", "..")
home_path = os.path.abspath(home_path)
def callback(func, path, exc_info):
print(f"remove \"{path}\" failed.")
def rmtree(path):
if os.path.isdir(path):
print(f"remove \"{path}\" recursive.")
shutil.rmtree(path, onerror=callback)
def remove_tmpfile():
dist_file = home_path+"/dist"
egg_file = glob.glob(home_path+"/**/*egg-info")
rmtree(dist_file)
for e in egg_file:
rmtree(e)
def run_cmd(cmd):
print("[CMD]", cmd)
assert os.system(cmd)==0
os.chdir(home_path)
remove_tmpfile()
run_cmd(f"{sys.executable} ./setup.py sdist")
run_cmd(f"{sys.executable} -m twine upload dist/*")
remove_tmpfile()

View File

@ -16,9 +16,6 @@ Reference:
from warnings import warn
import os
import platform
import site
import sys
site.ENABLE_USER_SITE = "--user" in sys.argv[1:]
if not platform.system() in ['Linux', 'Darwin']:
assert os.environ.get("FORCE_INSTALL", '0') != '1', error_msg