diff --git a/buildwheels.py b/buildwheels.py index 49188aec6b09f55857c7247e0e975f13fa322806..61715a3a3744965d1caceb1a74cf01e49ca57226 100644 --- a/buildwheels.py +++ b/buildwheels.py @@ -20,24 +20,33 @@ else: if k not in os.environ: raise KeyError(f'You must set the twine environment variable {k}') -for pyver in ['3.7','3.8','3.9']: - # Build the wheel if it is not already built - abbrv = pyver.replace('.', '') - if not glob.glob(f'teqp*cp{abbrv}*.whl'): +def build(): + for pyver in ['3.7','3.8','3.9']: + # Build the wheel if it is not already built + abbrv = pyver.replace('.', '') condaenv = f'conda-{pyver}' subprocess.check_call(f'conda create -y -n {condaenv} python={pyver}', shell=True) subprocess.check_call(f'conda activate {condaenv} && python -m pip install -U pip wheel', shell=True) try: - subprocess.check_call(f'conda activate {condaenv} && python -m pip -vvv --use-feature=in-tree-build wheel .', shell=True) - except: - pass + subprocess.check_call(f'conda activate {condaenv} && python -m pip -vvv wheel .', shell=True) + except BaseException as be: + print(be) finally: subprocess.check_call(f'conda env remove -y -n {condaenv}',shell=True) -# Upload wheels -if userc: - twine_call = f'twine upload --config-file pypirc *.whl' -else: - twine_call = f'twine upload *.whl' +def upload(): + # Upload wheels + if userc: + twine_call = f'twine upload --config-file pypirc *.whl' + else: + twine_call = f'twine upload *.whl' + subprocess.check_call(twine_call, shell=True) + +steps = ['build','upload'] +if not any([k in sys.argv for k in steps]): + raise ValueError("need to pass at least one step to do: '+str(steps)") -subprocess.check_call(twine_call, shell=True) \ No newline at end of file +if 'build' in sys.argv: + build() +if 'upload' in sys.argv: + upload() \ No newline at end of file