Skip to content

Commit

Permalink
Everything should work now (fingers crossed)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmloose committed Sep 5, 2024
1 parent 192dfd9 commit 1f03e48
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 126 deletions.
38 changes: 17 additions & 21 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
name: Build and upload to PyPI

# # Only build and upload when a new release tag is created
# on:
# push:
# tags:
# - "v[0-9]+.[0-9]+.[0-9]+"
# - "v[0-9]+.[0-9]+.[0-9]+[a-z]+[0-9]+"
# Only build and upload when a new release tag is created
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+[a-z]+[0-9]+"
# Alternatively, build on every branch push, tag push, and pull request change
on: [push] #, pull_request]
# on: [push, pull_request]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
# os: [ubuntu-latest, macos-12, macos-14]
os: [ubuntu-latest, macos-14]
os: [ubuntu-latest, macos-12, macos-14]
toolchain:
- {compiler: gcc, version: 12}
include:
# - os: macos-12
# macosx_deployment_target: "12.0"
- os: macos-12
macosx_deployment_target: "12.0"
- os: macos-14
macosx_deployment_target: "14.0"

steps:
- uses: actions/checkout@v4
with:
# Needed for `setuptools-scm`
fetch-depth: 0
fetch-depth: 0 # needed for versioning with `setuptools-scm`

- name: Setup Fortran
uses: fortran-lang/setup-fortran@v1
Expand All @@ -57,8 +55,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
# Needed for `setuptools-scm`
fetch-depth: 0
fetch-depth: 0 # needed for versioning with `setuptools-scm`

- name: Build sdist
run: pipx run build --sdist
Expand All @@ -69,6 +66,7 @@ jobs:
path: dist/*.tar.gz

upload_pypi:
name: Publish on PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
Expand All @@ -80,12 +78,10 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
# unpack artifacts in `dist` where the next action expects them to be
path: dist
path: dist # put artifacts where next action expects them to be
merge-multiple: true
- uses: pypa/[email protected]
with:
skip-existing: true
verbose: true
# To test:
repository-url: https://test.pypi.org/legacy/
# repository-url: https://test.pypi.org/legacy/
200 changes: 100 additions & 100 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ project(PyBDSF C CXX Fortran)

find_package(PythonExtensions REQUIRED)
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
# find_package(F2PY REQUIRED)
# find_package(Boost COMPONENTS python numpy REQUIRED)
find_package(F2PY REQUIRED)
find_package(Boost COMPONENTS python numpy REQUIRED)

if(SKBUILD)
message(STATUS "The project is built using scikit-build")
Expand All @@ -16,107 +16,107 @@ else()
set(PYTHON_INCLUDE_DIRS ${Python_INCLUDE_DIRS})
endif()

# ## -- Static library: minpack -- ##
# set(MINPACK_SRC
# src/minpack/lmder.f
# src/minpack/lmpar.f
# src/minpack/qrfac.f
# src/minpack/qrsolv.f
# src/minpack/enorm.f
# src/minpack/dpmpar.f
# )
# add_library(minpack STATIC ${MINPACK_SRC})
# set_target_properties(minpack PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
## -- Static library: minpack -- ##
set(MINPACK_SRC
src/minpack/lmder.f
src/minpack/lmpar.f
src/minpack/qrfac.f
src/minpack/qrsolv.f
src/minpack/enorm.f
src/minpack/dpmpar.f
)
add_library(minpack STATIC ${MINPACK_SRC})
set_target_properties(minpack PROPERTIES POSITION_INDEPENDENT_CODE TRUE)

# ## -- Static library: port3 -- ##
# set(PORT3_SRC
# src/port3/dnsg.f
# src/port3/dn2g.f
# src/port3/drnsg.f
# src/port3/drn2g.f
# src/port3/d1mach.f
# src/port3/da7sst.f
# src/port3/dc7vfn.f
# src/port3/dd7tpr.f
# src/port3/dd7upd.f
# src/port3/df7hes.f
# src/port3/dg7lit.f
# src/port3/dg7qts.f
# src/port3/ditsum.f
# src/port3/divset.f
# src/port3/dl7itv.f
# src/port3/dl7ivm.f
# src/port3/dl7mst.f
# src/port3/dl7nvr.f
# src/port3/dl7sqr.f
# src/port3/dl7srt.f
# src/port3/dl7svn.f
# src/port3/dl7svx.f
# src/port3/dl7tsq.f
# src/port3/dl7tvm.f
# src/port3/dl7vml.f
# src/port3/dn2cvp.f
# src/port3/dn2lrd.f
# src/port3/dn2rdp.f
# src/port3/do7prd.f
# src/port3/dparck.f
# src/port3/dq7apl.f
# src/port3/dq7rad.f
# src/port3/dq7rfh.f
# src/port3/dr7mdc.f
# src/port3/drldst.f
# src/port3/ds7cpr.f
# src/port3/ds7lup.f
# src/port3/ds7lvm.f
# src/port3/dv2axy.f
# src/port3/dv2nrm.f
# src/port3/dv7cpy.f
# src/port3/dv7dfl.f
# src/port3/dv7prm.f
# src/port3/dv7scl.f
# src/port3/dv7scp.f
# src/port3/dv7swp.f
# src/port3/i1mach.f
# src/port3/i7mdcn.f
# src/port3/stopx.f
# )
# add_library(port3 STATIC ${PORT3_SRC})
# set_target_properties(port3 PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
## -- Static library: port3 -- ##
set(PORT3_SRC
src/port3/dnsg.f
src/port3/dn2g.f
src/port3/drnsg.f
src/port3/drn2g.f
src/port3/d1mach.f
src/port3/da7sst.f
src/port3/dc7vfn.f
src/port3/dd7tpr.f
src/port3/dd7upd.f
src/port3/df7hes.f
src/port3/dg7lit.f
src/port3/dg7qts.f
src/port3/ditsum.f
src/port3/divset.f
src/port3/dl7itv.f
src/port3/dl7ivm.f
src/port3/dl7mst.f
src/port3/dl7nvr.f
src/port3/dl7sqr.f
src/port3/dl7srt.f
src/port3/dl7svn.f
src/port3/dl7svx.f
src/port3/dl7tsq.f
src/port3/dl7tvm.f
src/port3/dl7vml.f
src/port3/dn2cvp.f
src/port3/dn2lrd.f
src/port3/dn2rdp.f
src/port3/do7prd.f
src/port3/dparck.f
src/port3/dq7apl.f
src/port3/dq7rad.f
src/port3/dq7rfh.f
src/port3/dr7mdc.f
src/port3/drldst.f
src/port3/ds7cpr.f
src/port3/ds7lup.f
src/port3/ds7lvm.f
src/port3/dv2axy.f
src/port3/dv2nrm.f
src/port3/dv7cpy.f
src/port3/dv7dfl.f
src/port3/dv7prm.f
src/port3/dv7scl.f
src/port3/dv7scp.f
src/port3/dv7swp.f
src/port3/i1mach.f
src/port3/i7mdcn.f
src/port3/stopx.f
)
add_library(port3 STATIC ${PORT3_SRC})
set_target_properties(port3 PROPERTIES POSITION_INDEPENDENT_CODE TRUE)

# ## -- F2py module: pytesselate -- ##
# set(F2PY_MODULE_NAME "_pytesselate")
# set(F2PY_MODULE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${F2PY_MODULE_NAME}${PYTHON_EXTENSION_MODULE_SUFFIX})
# set(PYTESSELATE_SRC
# ${CMAKE_SOURCE_DIR}/src/fortran/pytess_roundness.f
# ${CMAKE_SOURCE_DIR}/src/fortran/pytess_simple.f
# ${CMAKE_SOURCE_DIR}/src/fortran/constants.h
# )
# add_custom_target(${F2PY_MODULE_NAME} ALL
# DEPENDS ${F2PY_MODULE_FILE}
# )
# add_custom_command(
# OUTPUT ${F2PY_MODULE_FILE}
# COMMAND ${F2PY_EXECUTABLE} -m ${F2PY_MODULE_NAME} -c ${PYTESSELATE_SRC}
# COMMENT "[F2PY] Building python extension module ${F2PY_MODULE_NAME}"
# )
# install(FILES ${F2PY_MODULE_FILE} DESTINATION bdsf)
## -- F2py module: pytesselate -- ##
set(F2PY_MODULE_NAME "_pytesselate")
set(F2PY_MODULE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${F2PY_MODULE_NAME}${PYTHON_EXTENSION_MODULE_SUFFIX})
set(PYTESSELATE_SRC
${CMAKE_SOURCE_DIR}/src/fortran/pytess_roundness.f
${CMAKE_SOURCE_DIR}/src/fortran/pytess_simple.f
${CMAKE_SOURCE_DIR}/src/fortran/constants.h
)
add_custom_target(${F2PY_MODULE_NAME} ALL
DEPENDS ${F2PY_MODULE_FILE}
)
add_custom_command(
OUTPUT ${F2PY_MODULE_FILE}
COMMAND ${F2PY_EXECUTABLE} -m ${F2PY_MODULE_NAME} -c ${PYTESSELATE_SRC}
COMMENT "[F2PY] Building python extension module ${F2PY_MODULE_NAME}"
)
install(FILES ${F2PY_MODULE_FILE} DESTINATION bdsf)

# ## -- Python module: _cbdsm -- ##
# set(CBDSM_SRC
# src/c++/Fitter_dn2g.cc
# src/c++/Fitter_dnsg.cc
# src/c++/Fitter_lmder.cc
# src/c++/MGFunction1.cc
# src/c++/MGFunction2.cc
# src/c++/cbdsm_main.cc
# src/c++/stat.cc
# src/c++/num_util/num_util.cpp
# )
# add_library(_cbdsm MODULE ${CBDSM_SRC})
# target_include_directories(_cbdsm PRIVATE src/c++)
# target_link_libraries(_cbdsm minpack port3 gfortran ${Boost_LIBRARIES})
# python_extension_module(_cbdsm)
# install(TARGETS _cbdsm LIBRARY DESTINATION bdsf)
## -- Python module: _cbdsm -- ##
set(CBDSM_SRC
src/c++/Fitter_dn2g.cc
src/c++/Fitter_dnsg.cc
src/c++/Fitter_lmder.cc
src/c++/MGFunction1.cc
src/c++/MGFunction2.cc
src/c++/cbdsm_main.cc
src/c++/stat.cc
src/c++/num_util/num_util.cpp
)
add_library(_cbdsm MODULE ${CBDSM_SRC})
target_include_directories(_cbdsm PRIVATE src/c++)
target_link_libraries(_cbdsm minpack port3 gfortran ${Boost_LIBRARIES})
python_extension_module(_cbdsm)
install(TARGETS _cbdsm LIBRARY DESTINATION bdsf)

## -- Python module: natgrid -- ##
set(NATGRID_SRC
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ Documentation = "https://pybdsf.readthedocs.io"
#########################

[tool.cibuildwheel]
# before-all = "cibuildwheel/before_all.sh"
# before-build = "cibuildwheel/before_build.sh"
#build = "cp3{8,9,10,11,12}-*"
build = "cp312-*"
before-all = "cibuildwheel/before_all.sh"
before-build = "cibuildwheel/before_build.sh"
build = "cp3{8,9,10,11,12}-*"
build-verbosity = 1
environment = """ \
BOOST_VERSION="1.85.0" \
Expand All @@ -90,7 +89,7 @@ environment = """ \
FC=gfortran \
LD_LIBRARY_PATH="${BOOST_INSTALL_DIR}/lib" \
"""
# test-command = "cd {package}/test && python tbdsf_process_image.py"
test-command = "cd {package}/test && python tbdsf_process_image.py"

[tool.cibuildwheel.macos]
repair-wheel-command = """\
Expand Down

0 comments on commit 1f03e48

Please sign in to comment.