-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
303 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*~ | ||
__pycache__ | ||
*.egg-info | ||
build | ||
dist | ||
*.so | ||
*.pyd | ||
*.dll | ||
*.so.* | ||
.idea | ||
*.dylib | ||
.vscode | ||
test_ODB/ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
os: | ||
- linux | ||
language: python | ||
python: | ||
- "3.6" | ||
# command to install dependencies | ||
install: | ||
- pip install -r requirements.txt | ||
- pip install coveralls | ||
- pip install codecov | ||
- pip install pytest-cov | ||
# command to run tests | ||
script: | ||
- py.test --cov=./ | ||
after_success: | ||
- coveralls # uploads reports to coveralls.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# OpenSeesPy Windows | ||
|
||
Pip Package for OpenSeesPy Windows | ||
|
||
## Installation | ||
|
||
```bash | ||
pip install openseespywin | ||
``` | ||
|
||
## Import | ||
|
||
```python | ||
import openseespywin as ops | ||
``` | ||
|
||
## Documentation | ||
|
||
[OpenSeesPy Documentation](https://openseespydoc.readthedocs.io/en/latest/index.html) | ||
|
||
[OpenSeesPy Source Code](github.com/OpenSees/OpenSees) | ||
|
||
## Issues | ||
|
||
Any issues for installation and running the pip package, please | ||
report to | ||
[OpenSeesPy Github Page](https://github.com/zhuminjie/OpenSeesPy). | ||
|
||
Any issues and bugs in `OpenSees` should be | ||
reported on the [OpenSees GitHub Page](https://github.com/OpenSees/OpenSees). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
import subprocess | ||
import shutil | ||
import os | ||
import os.path | ||
import sys | ||
import glob | ||
|
||
|
||
def copy_win_library(pyd): | ||
|
||
# change to script's folder | ||
os.chdir(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
# replace new libraries | ||
win = './openseespywin/' | ||
|
||
if os.path.exists(pyd): | ||
if os.path.exists(win+'opensees.pyd'): | ||
os.remove(win+'opensees.pyd') | ||
shutil.copy(pyd, win) | ||
|
||
|
||
def build_pip(pyexe='python', use_zip=False): | ||
|
||
# clean folders | ||
subprocess.run(['rm', '-fr', 'build', 'dist', 'openseespywin.egg-info']) | ||
|
||
# update tools | ||
subprocess.run([pyexe, '-m', 'pip', 'install', '--upgrade', | ||
'setuptools', 'wheel', 'twine', 'pytest']) | ||
|
||
# compile wheel | ||
if use_zip: | ||
subprocess.run([pyexe, 'setup.py', 'bdist', '--format=zip']) | ||
else: | ||
subprocess.run([pyexe, 'setup.py', 'bdist_wheel']) | ||
|
||
|
||
def upload_pip(pyexe='python'): | ||
# upload | ||
subprocess.run([pyexe, '-m', 'twine', 'upload', 'dist/*']) | ||
|
||
|
||
def clean_pip(): | ||
subprocess.run(['rm', '-fr', 'build', 'dist', 'openseespywin.egg-info']) | ||
|
||
|
||
def upload_pip_test(pyexe='python'): | ||
# upload | ||
subprocess.run([pyexe, '-m', 'twine', 'upload', | ||
'--repository', 'testpypi', 'dist/*']) | ||
|
||
|
||
def install_pip_test(pyexe='python'): | ||
subprocess.run([pyexe, '-m', 'pip', 'uninstall', '-y', 'openseespywin']) | ||
subprocess.run([pyexe, '-m', 'pip', 'install', '--pre', '--no-cache-dir', '--index-url', | ||
'https://test.pypi.org/simple/', 'openseespywin']) | ||
|
||
|
||
def install_pip(pyexe='python'): | ||
subprocess.run([pyexe, '-m', 'pip', 'uninstall', '-y', 'openseespywin']) | ||
subprocess.run([pyexe, '-m', 'pip', 'install', | ||
'--pre', '--no-cache-dir', 'openseespywin']) | ||
|
||
|
||
# commands: | ||
# | ||
# pyexe - python excutable | ||
# | ||
# build pip | ||
# build_pip pyexe build pyd use_zip/no_zip | ||
# pyd - path to opensees.pyd | ||
# use_zip - build the package to a zip file | ||
# no_zip - build the package to a wheel file | ||
# | ||
# upload to testpypi | ||
# build_pip pyexe upload-test | ||
# | ||
# upload to pypi | ||
# build_pip pyexe upload | ||
# | ||
# test package from testpypi | ||
# build_pip pyexe test-test | ||
# | ||
# test package from pypi | ||
# build_pip pyexe test | ||
# | ||
if __name__ == "__main__": | ||
|
||
if len(sys.argv) < 2: | ||
print('build_pip pyexe cmd') | ||
exit() | ||
|
||
pyexe = sys.argv[1] | ||
|
||
if sys.argv[2] == 'build': | ||
if len(sys.argv) < 5: | ||
print('buld_pip pyexe build pyd use_zip/no_zip') | ||
exit() | ||
|
||
pyd = sys.argv[3] | ||
use_zip = False | ||
if sys.argv[4] == 'use_zip': | ||
use_zip = True | ||
|
||
clean_pip() | ||
copy_win_library(pyd) | ||
build_pip(pyexe, use_zip=use_zip) | ||
|
||
elif sys.argv[2] == 'upload-test': | ||
|
||
if len(sys.argv) < 3: | ||
print('buld_pip pyexe upload-test') | ||
exit() | ||
upload_pip_test(pyexe) | ||
|
||
elif sys.argv[2] == 'upload': | ||
|
||
if len(sys.argv) < 3: | ||
print('buld_pip pyexe upload') | ||
exit() | ||
|
||
upload_pip(pyexe) | ||
|
||
elif sys.argv[2] == 'test-test': | ||
|
||
if len(sys.argv) < 3: | ||
print('buld_pip pyexe test-test') | ||
exit() | ||
|
||
install_pip_test(pyexe) | ||
subprocess.run(['pytest', '--pyargs', 'openseespywin.test']) | ||
|
||
elif sys.argv[2] == 'test': | ||
|
||
if len(sys.argv) < 3: | ||
print('buld_pip pyexe test') | ||
exit() | ||
|
||
install_pip(pyexe) | ||
subprocess.run(['pytest', '--pyargs', 'openseespywin.test']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
coverage | ||
codecov | ||
pylint | ||
twine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 - 2020 Minjie Zhu | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import ctypes | ||
import sys | ||
|
||
# only work for 64 bit system | ||
if sys.maxsize < 2**31: | ||
raise RuntimeError('64 bit system is required') | ||
|
||
# platform dependent | ||
if sys.platform.startswith('win'): | ||
|
||
if sys.version_info[0] == 3 and sys.version_info[1] == 8: | ||
dll_path = '' | ||
for path in sys.path: | ||
if 'DLLs' in path: | ||
dll_path = path | ||
break | ||
ctypes.cdll.LoadLibrary(dll_path + '\\tcl86t.dll') | ||
|
||
try: | ||
from openseespywin.opensees import * | ||
from openseespywin.version import * | ||
except: | ||
raise RuntimeError('Failed to import openseespy on Linux.') | ||
else: | ||
raise RuntimeError( | ||
'Python version 3.8 is needed for Windows') | ||
|
||
else: | ||
|
||
raise RuntimeError('This package is for Windows only') |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import openseespylinux as ops | ||
|
||
ops.wipe() | ||
ops.model('basic', '-ndm', 2, '-ndf', 3) | ||
|
||
ops.node(1, 0.0, 0.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version = "3.2.2.9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pytest | ||
matplotlib | ||
numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import setuptools | ||
|
||
about = {} | ||
with open('openseespywin/version.py') as fp: | ||
exec(fp.read(), about) | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
setuptools.setup( | ||
name="openseespywin", | ||
version=about['version'], | ||
author="Minjie Zhu", | ||
author_email="zhum@oregonstate.edu", | ||
description="A OpenSeesPy Windows package", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/openseespy/openseespy", | ||
packages=setuptools.find_packages(), | ||
package_data={ | ||
'': [ | ||
'opensees.pyd', | ||
'LICENSE.md', | ||
'*.dat', | ||
'*.at2',], | ||
}, | ||
license='LICENSE.md', | ||
classifiers=[ | ||
"Programming Language :: Python :: 3.8", | ||
'Operating System :: Microsoft :: Windows'], | ||
platforms=["Windows"], | ||
python_requires='>=3.6', | ||
zip_safe=False) |