Skip to content

Commit

Permalink
merged with pip
Browse files Browse the repository at this point in the history
  • Loading branch information
dwr-psandhu committed Dec 17, 2024
2 parents 8aaf08b + 8ea3d08 commit 18a42ae
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 88 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/build.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/buildwheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

on: [push, pull_request]

jobs:
build-wheel:
runs-on: ubuntu-latest

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12"]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install ifort dependencies (Windows)
if: matrix.os == 'windows-latest'
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine numpy versioneer
- name: Build wheel
run: |
python -m build --wheel
- name: Upload Python Package to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload dist/*
6 changes: 3 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ auto versioning turned on

0.5.1
-----
Fixed for '*' in catalog file in case of missing periods
Fixed for '\*' in catalog file in case of missing periods

0.5.0
-----
Expand All @@ -75,15 +75,15 @@ fix for issue 15: units 'M' and 'Y' no longer supported

0.2.9
-----
Fixed issue with end of timestamp writing to dss files for "PER-*" data type
Fixed issue with end of timestamp writing to dss files for "PER-\*" data type

0.2.8
-----
Recompiled heclib in linux with latest compilers to resolve issue 8

0.2.7
-----
Partial fixes for offset: Fixed for INST-* timeseries but not PER-* timeseries (issue #12)
Partial fixes for offset: Fixed for "INST-\*" timeseries but not "PER-\*" timeseries (issue #12)

0.2.6
-----
Expand Down
69 changes: 55 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,74 @@
"""
setup.py file for SWIG example
"""

# from distutils.core import setup, Extension
import codecs
import os
import platform
import numpy
import versioneer
from setuptools import setup, Extension, find_packages


def get_numpy_include():
try:
return numpy.get_include()
except AttributeError:
return numpy.get_numpy_include()

# Platform-specific compile and link options
if platform.system() == 'Linux':
extra_links = ['-fno-exceptions', '-fno-rtti', '-shared', '-lgfortran', '-lstdc++']
libs = ['heclib6-WE']
libdirs = ['./extensions']
compile_args = ['-D_GNU_SOURCE', '-fno-exceptions']
elif platform.system() == 'Windows':
numpy_include = numpy.get_numpy_include()
return numpy_include


##------------------ VERSIONING BEST PRACTICES --------------------------##

here = os.path.abspath(os.path.dirname(__file__))


def read(*parts):
with codecs.open(os.path.join(here, *parts), "r") as fp:
return fp.read()


with open("README.rst") as readme_file:
readme = readme_file.read()

with open("CHANGELOG.rst") as history_file:
history = history_file.read()

requirements = ["numpy", "pandas"]

setup_requirements = []

test_requirements = ["pytest"]


##------------ COMPILE LINK OPTIONS for Linux and Windows ----------------#

if platform.system() == "Linux":
# https://stackoverflow.com/questions/329059/what-is-gxx-personality-v0-for
extra_links = ["-fno-exceptions", "-fno-rtti", "-shared", "-lgfortran", "-lstdc++"]
libs = ["heclib6-WE"] # linux
libdirs = ["./extensions"] # linux
compile_args = ["-D_GNU_SOURCE", "-fno-exceptions"] # linux
elif platform.system() == "Windows":
extra_links = ["/NODEFAULTLIB:LIBCMT"]
libs = ['extensions/heclib6-VE']
libs = [
"extensions/heclib6-VE",
]
libdirs = []
compile_args = []
else:
raise Exception(f"Unknown platform: {platform.system()}! You are on your own")
raise Exception("Unknown platform: " + platform.system() + "! You are on your own")


# check_numpy_i() #--This is failing due SSL certificate issue
#
pyheclib_module = Extension(
'pyhecdss._pyheclib',
sources=['pyhecdss/pyheclib.i', 'pyhecdss/hecwrapper.c'],
swig_opts=[],
"pyhecdss._pyheclib",
sources=["pyhecdss/pyheclib.i", "pyhecdss/hecwrapper.c"],
swig_opts=[
"-py3",
],
libraries=libs,
library_dirs=libdirs,
extra_compile_args=compile_args,
Expand Down

0 comments on commit 18a42ae

Please sign in to comment.