1919import os
2020from skbuild import setup
2121from setuptools import Command
22-
22+ import sys
2323
2424# Determine platform
2525platform_system = platform .system ()
@@ -56,11 +56,28 @@ def run(self):
5656 p .wait ()
5757
5858
59- # Set up location of wheel libraries depending on build platform
60- if platform_system == "Windows" :
61- package_dir = {"swmm_toolkit" :"bin" , "swmm.toolkit" : "src/swmm/toolkit" }
59+ # Set up location of wheel libraries depending on build platform and command
60+ # commands that trigger cmake from skbuild.setuptools_wrap._should_run_cmake
61+ commands_that_trigger_cmake = {
62+ "build" ,
63+ "build_ext" ,
64+ "develop" ,
65+ "install" ,
66+ "install_lib" ,
67+ "bdist" ,
68+ "bdist_dumb" ,
69+ "bdist_egg" ,
70+ "bdist_rpm" ,
71+ "bdist_wininst" ,
72+ "bdist_wheel" ,
73+ "test" ,
74+ }
75+ command = sys .argv [1 ] if len (sys .argv ) > 1 else None
76+ if command in commands_that_trigger_cmake :
77+ swmm_toolkit_dir = "bin" if platform_system == "Windows" else "lib"
6278else :
63- package_dir = {"swmm_toolkit" :"lib" , "swmm.toolkit" : "src/swmm/toolkit" }
79+ swmm_toolkit_dir = "swmm-solver"
80+ package_dir = {"swmm_toolkit" : swmm_toolkit_dir , "swmm.toolkit" : "src/swmm/toolkit" }
6481
6582
6683if os .environ .get ('SWMM_CMAKE_ARGS' ) is not None :
@@ -88,7 +105,6 @@ def exclude_files(cmake_manifest):
88105here = pathlib .Path (__file__ ).parent .resolve ()
89106long_description = (here / 'README.md' ).read_text (encoding = 'utf-8' )
90107
91-
92108setup (
93109 name = "swmm-toolkit" ,
94110 version = "0.14.2" ,
@@ -127,4 +143,4 @@ def exclude_files(cmake_manifest):
127143 "Programming Language :: C" ,
128144 "Development Status :: 5 - Production/Stable" ,
129145 ]
130- )
146+ )
0 commit comments