Skip to content
Snippets Groups Projects
Commit d1eafbd0 authored by Ian Bell's avatar Ian Bell
Browse files

Make the wheel building script a bit more powerful

parent fe33e0be
No related branches found
No related tags found
No related merge requests found
...@@ -20,24 +20,33 @@ else: ...@@ -20,24 +20,33 @@ else:
if k not in os.environ: if k not in os.environ:
raise KeyError(f'You must set the twine environment variable {k}') raise KeyError(f'You must set the twine environment variable {k}')
for pyver in ['3.7','3.8','3.9']: def build():
# Build the wheel if it is not already built for pyver in ['3.7','3.8','3.9']:
abbrv = pyver.replace('.', '') # Build the wheel if it is not already built
if not glob.glob(f'teqp*cp{abbrv}*.whl'): abbrv = pyver.replace('.', '')
condaenv = f'conda-{pyver}' condaenv = f'conda-{pyver}'
subprocess.check_call(f'conda create -y -n {condaenv} python={pyver}', shell=True) 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) subprocess.check_call(f'conda activate {condaenv} && python -m pip install -U pip wheel', shell=True)
try: try:
subprocess.check_call(f'conda activate {condaenv} && python -m pip -vvv --use-feature=in-tree-build wheel .', shell=True) subprocess.check_call(f'conda activate {condaenv} && python -m pip -vvv wheel .', shell=True)
except: except BaseException as be:
pass print(be)
finally: finally:
subprocess.check_call(f'conda env remove -y -n {condaenv}',shell=True) subprocess.check_call(f'conda env remove -y -n {condaenv}',shell=True)
# Upload wheels def upload():
if userc: # Upload wheels
twine_call = f'twine upload --config-file pypirc *.whl' if userc:
else: twine_call = f'twine upload --config-file pypirc *.whl'
twine_call = f'twine upload *.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) if 'build' in sys.argv:
\ No newline at end of file build()
if 'upload' in sys.argv:
upload()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment