File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
wrappers/python/wheels.github Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 2828"""
2929
3030# Read the version from the CMakeLists.txt
31- version = ""
31+ version = []
3232with open ('CMakeLists.txt' , 'r' ) as f :
3333 txt = f .read ()
3434 for name in ('MAJOR' , 'MINOR' , 'PATCH' ):
3535 prefix = 'set(MOORDYN_{}_VERSION ' .format (name )
3636 subtxt = txt [txt .find (prefix ) + len (prefix ):]
3737 subtxt = subtxt [:subtxt .find (')\n ' )]
38- version = version + subtxt + '.'
39- version = version [:- 1 ]
38+ version += subtxt
4039
4140
42- with open ('pyproject.toml' , 'r' ) as f :
43- txt = f .read ()
41+ for fname in ('pyproject.toml' , 'setup.py' ):
42+ with open (fname , 'r' ) as f :
43+ txt = f .read ()
4444
45- txt = txt .replace (r"${MOORDYN_VERSION}" , version )
45+ for i , name in enumerate (('MAJOR' , 'MINOR' , 'PATCH' )):
46+ txt = txt .replace (r"${MOORDYN_" + name + r"_VERSION}" , version [i ])
47+ txt = txt .replace (r"${MOORDYN_VERSION}" ,
48+ version [0 ] + "." + version [1 ] + "." + version [2 ])
4649
47- with open ('pyproject.toml' , 'w' ) as f :
48- f .write (txt )
50+ with open (fname , 'w' ) as f :
51+ f .write (txt )
Original file line number Diff line number Diff line change @@ -90,7 +90,10 @@ def arefiles(files):
9090elif platform .system () == "Darwin" :
9191 # To avoid errors with std::filesystem::path
9292 extra_compile_args .append ("-mmacosx-version-min=10.15" )
93- definitions = [('MoorDyn_EXPORTS' , '1' ),]
93+ definitions = [('MoorDyn_EXPORTS' , '1' ),
94+ ('MOORDYN_MAJOR_VERSION' , '${MOORDYN_MAJOR_VERSION}' ),
95+ ('MOORDYN_MINOR_VERSION' , '${MOORDYN_MINOR_VERSION}' ),
96+ ('MOORDYN_PATCH_VERSION' , '${MOORDYN_PATCH_VERSION}' )]
9497include_dirs = [MOORDYN_PATH , "vtk/include/vtk-" + vtk_version ]
9598if platform .system () == "Windows" :
9699 extra_link_args = [
You can’t perform that action at this time.
0 commit comments