Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conda package lib inclusion #9

Merged
merged 10 commits into from
Feb 19, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ jobs:
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
condarc: |
channels:
- mcvine
- conda-forge
- name: build python wheel
shell: bash -l {0}
run: |
python -m build --wheel --no-isolation
check-wheel-contents dist/histogram*.whl
- name: build conda package
run: |
# set up environment
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
CHANNELS="--channel mcvine --channel conda-forge"
CHANNELS="--channel conda-forge"
VERSION=$(versioningit ../) conda mambabuild $CHANNELS --output-folder . .
conda verify noarch/histogram*.tar.bz2
- name: upload conda package to anaconda
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ histogram data object
# create a conda package
$ cd conda.recipe
$ echo "versioningit $(versioningit ../)"
$ CHANNELS="--channel mcvine --channel conda-forge"
$ CHANNELS="--channel conda-forge"
$ VERSION=$(versioningit ../) conda mambabuild $CHANNELS --output-folder . .
$ conda verify noarch/histogram-*.tar.bz2
# install a local conda package
Expand Down
31 changes: 0 additions & 31 deletions conda.recipe/_build.sh

This file was deleted.

23 changes: 23 additions & 0 deletions conda.recipe/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

#lib folder
mkdir -p $PREFIX/include/histogram
cp -r lib/* $PREFIX/include/histogram/

# in case a shared library is needed
# shared library for linux
# cd lib/
# src_files=$(ls *.cc)

# mkdir -p $PREFIX/lib
# ${CXX} -c -fPIC $src_files
# ${CXX} -shared -o $PREFIX/lib/libhistogram.so $(ls *.o)
# cd ..

#Python files
mkdir -p $PREFIX/lib/python$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')/site-packages/histogram
cp -r src/histogram/* $PREFIX/lib/python$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')/site-packages/histogram/

#Executable plothist
mkdir -p $PREFIX/bin
cp -r bin/plothist $PREFIX/bin/
9 changes: 7 additions & 2 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ package:
source:
path: ..


build:
script_env:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
noarch: python
number: {{ build_number }}
string: py{{py}}
script: {{ PYTHON }} -m pip install . --no-deps --ignore-installed -vvv

requirements:
host:
Expand All @@ -34,8 +36,11 @@ requirements:
build:
- setuptools>=42
- versioningit

run:
- numpy
- matplotlib
- h5py

test:
imports:
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: histogram-dev
channels:
- mcvine
- conda-forge
dependencies:
- anaconda-client
Expand Down
4 changes: 2 additions & 2 deletions src/histogram/Histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import operator
from .DictAttributeCont import AttributeCont
from . import _units as units
from histogram.utils.units.SI import second
import logging

logger = logging.getLogger("Histogram")
Expand Down Expand Up @@ -1102,10 +1104,8 @@ def test_equalUnit():
assert _equalUnit(1, 2) == False
assert _equalUnit(1, 1) == True
assert _equalUnit(1, 1 + 1e-10) == True
from . import _units as units

meter = units.length.meter
second = units.time.second
assert _equalUnit(1 * meter, 1 * meter) == True
assert _equalUnit(1 * meter, 1) == False
assert _equalUnit(1 * meter, 1 * second) == False
Expand Down
Loading