Skip to content

Commit

Permalink
use different python names on different platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuminjie committed Oct 15, 2020
1 parent bd11a82 commit eb32789
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 19 deletions.
26 changes: 13 additions & 13 deletions openseespy-pip/build_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def copy_mac_library(so):
os.remove(mac+'lib/Python')


def build_pip():
def build_pip(pyexe='python'):

print('==============================================================')
print('Did you remember to update version number in opensees source?')
Expand All @@ -81,35 +81,35 @@ def build_pip():
subprocess.run(['rm', '-fr', 'build', 'dist', 'openseespy.egg-info'])

# update tools
subprocess.run(['python3', '-m', 'pip', 'install', '--upgrade',
subprocess.run([pyexe, '-m', 'pip', 'install', '--upgrade',
'setuptools', 'wheel', 'twine', 'pytest'])

# compile wheel
subprocess.run(['python3', 'setup.py', 'bdist_wheel'])
subprocess.run([pyexe, 'setup.py', 'bdist_wheel'])


def upload_pip():
def upload_pip(pyexe='python')
# upload
subprocess.run(['python3', '-m', 'twine', 'upload', 'dist/*'])
subprocess.run([pyexe, '-m', 'twine', 'upload', 'dist/*'])


def clean_pip():
subprocess.run(['rm', '-fr', 'build', 'dist', 'openseespy.egg-info'])


def upload_pip_test():
def upload_pip_test(pyexe='python'):
# upload
subprocess.run(['python3', '-m', 'twine', 'upload',
subprocess.run([pyexe, '-m', 'twine', 'upload',
'--repository', 'testpypi', 'dist/*'])


def install_pip_test():
subprocess.run(['python3', '-m', 'pip', 'uninstall', '-y', 'openseespy'])
subprocess.run(['python3', '-m', 'pip', 'install', '--pre', '--no-cache-dir', '--index-url',
def install_pip_test(pyexe='python'):
subprocess.run([pyexe, '-m', 'pip', 'uninstall', '-y', 'openseespy'])
subprocess.run([pyexe, '-m', 'pip', 'install', '--pre', '--no-cache-dir', '--index-url',
'https://test.pypi.org/simple/', 'openseespy'])


def install_pip():
subprocess.run(['python3', '-m', 'pip', 'uninstall', '-y', 'openseespy'])
subprocess.run(['python3', '-m', 'pip', 'install',
def install_pip(pyexe='python'):
subprocess.run([pyexe, '-m', 'pip', 'uninstall', '-y', 'openseespy'])
subprocess.run([pyexe, '-m', 'pip', 'install',
'--pre', '--no-cache-dir', 'openseespy'])
9 changes: 7 additions & 2 deletions openseespy-pip/install_pip.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import subprocess
import sys

from build_pip import copy_linux_library, build_pip, upload_pip, clean_pip

pyexe = 'python'
if sys.platform.startswith('darwin'):
pyexe = 'python3'

copy_linux_library('../../opensees/SRC/interpreter/opensees.so')
build_pip()
upload_pip()
build_pip(pyexe)
upload_pip(pyexe)
clean_pip()
9 changes: 7 additions & 2 deletions openseespy-pip/install_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import subprocess
import sys

from build_pip import copy_linux_library, build_pip, upload_pip_test, clean_pip

pyexe = 'python'
if sys.platform.startswith('darwin'):
pyexe = 'python3'


copy_linux_library('../../opensees/SRC/interpreter/opensees.so')
build_pip()
upload_pip_test()
build_pip(pyexe)
upload_pip_test(pyexe)
clean_pip()
7 changes: 6 additions & 1 deletion openseespy-pip/test_pip.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import subprocess
import sys

from build_pip import install_pip

install_pip()
pyexe = 'python'
if sys.platform.startswith('darwin'):
pyexe = 'python3'

install_pip(pyexe)

subprocess.run(
['pytest', '--pyargs', 'openseespy.test']
Expand Down
7 changes: 6 additions & 1 deletion openseespy-pip/test_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import subprocess
import sys

from build_pip import install_pip_test

install_pip_test()
pyexe = 'python'
if sys.platform.startswith('darwin'):
pyexe = 'python3'

install_pip_test(pyexe)

subprocess.run(
['pytest', '--pyargs', 'openseespy.test']
Expand Down

0 comments on commit eb32789

Please sign in to comment.