Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*.exp
*.so
*.h
buildlib/

build/
dist/
Expand All @@ -23,3 +24,5 @@ output_wrap.c

toolkit.py
toolkit_wrap.c

swmm_python/toolkit/tests/data/test.*
34 changes: 34 additions & 0 deletions before_build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
::
:: before_build.bat - Prepares for swmm toolkit and output module builds
::
:: Date Created: 12/21/2018
::
:: Author: Michael E. Tryby
:: US EPA - ORD/NRMRL
::

set PROJECT_PATH=%~1

set TOOLKIT_PATH=\swmm_python\toolkit\swmm\toolkit
set OUTPUT_PATH=\swmm_python\output\swmm\output


mkdir buildlib
cd buildlib
git clone --branch=feature-wrapper https://github.com/michaeltryby/Stormwater-Management-Model.git swmm
cd swmm


mkdir buildprod
cd buildprod
cmake -G"Visual Studio 14 2015 Win64" -DBUILD_TESTS=0 ..
cmake --build . --config Release


copy /Y .\bin\Release\swmm5.dll %PROJECT_PATH%\%TOOLKIT_PATH%
copy /Y .\lib\Release\swmm5.lib %PROJECT_PATH%\%TOOLKIT_PATH%
copy /Y ..\include\*.h %PROJECT_PATH%\%TOOLKIT_PATH%

copy /Y .\bin\Release\swmm-output.dll %PROJECT_PATH%\%OUTPUT_PATH%
copy /Y .\lib\Release\swmm-output.lib %PROJECT_PATH%\%OUTPUT_PATH%
copy /Y ..\tools\swmm-output\include\*.h %PROJECT_PATH%\%OUTPUT_PATH%
14 changes: 0 additions & 14 deletions output/tests/data/__init__.py

This file was deleted.

72 changes: 72 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@


import os
import pathlib

from six import iteritems

from setuptools import setup
from setuptools.command.develop import develop
from setuptools.command.install import install


import sys
import subprocess


PACKAGE_NAME = 'swmm'
SOURCES = {
'swmm.toolkit': 'swmm_python/toolkit',
'swmm.output': 'swmm_python/output'
}


def install_microlibs(sources, develop=False):
""" Use pip to install all microlibraries. """
print("installing all microlibs in {} mode".format(
"development" if develop else "normal"))
wd = pathlib.Path.cwd()
for k, v in iteritems(sources):
try:
microlib_dir = os.fspath(wd.joinpath(v))
if develop:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-e', '.'], cwd=microlib_dir)
else:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '.'], cwd=microlib_dir)
except Exception as e:
print("Oops, something went wrong installing", k, microlib_dir)
print(e)
finally:
os.chdir(wd)


class DevelopCmd(develop):
""" Add custom steps for the develop command """
def run(self):
install_microlibs(SOURCES, develop=True)
develop.run(self)


class InstallCmd(install):
""" Add custom steps for the install command """
def run(self):
install_microlibs(SOURCES, develop=False)
install.run(self)


setup(
name=PACKAGE_NAME,
version="0.2.0a",
author="Michael Tryby",
author_email="Michael Tryby@epa.gov",
description="swmm_python - SWIG generated python wrappers for swmm libraries",
license="CC0",
classifiers=[
'Private :: Do Not Upload to pypi server',
],
cmdclass={
'install': InstallCmd,
'develop': DevelopCmd

}
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


aenum

-e ./
17 changes: 10 additions & 7 deletions output/setup.py → swmm_python/output/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

#
# setup.py - Setup script for swmm_output python extension
#
#
# Created: 7/2/2018
# Author: Michael E. Tryby
# US EPA - ORD/NRMRL
#
# Requires:
# Platform C language compiler
# Platform C language compiler
# SWIG
#

Expand All @@ -20,12 +20,14 @@
from distutils.command.build_ext import build_ext


microlib_name = 'swmm.output'

setup(
name = "swmm-output",
name = microlib_name,
version = "0.3.0-dev",

ext_modules = [
Extension("swmm.output._output",
Extension("swmm.output._output",
include_dirs = ['swmm/output/'],
libraries = ['swmm-output'],
library_dirs = ['swmm/output/'],
Expand All @@ -34,10 +36,11 @@
language='C'
)
],
packages = ['swmm.output'],
namespace_packages=['swmm'],
packages = [microlib_name],
py_modules = ['output'],
package_data = {'swmm.output':['*swmm-output.dll', '*swmm-output.so']},
package_data = {microlib_name:['*swmm-output.dll', '*swmm-output.so']},

install_requires = [
'aenum'
]
Expand Down
File renamed without changes.
Loading