Skip to content

Commit 7d7e17f

Browse files
committed
two conda build outputs, renamed linecount to aligncount_cpp
1 parent e297c5b commit 7d7e17f

File tree

8 files changed

+126
-51
lines changed

8 files changed

+126
-51
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ ExternalProject_Get_Property(doctest source_dir)
2323
set(DOCTEST_INCLUDE_DIR ${source_dir}/doctest CACHE INTERNAL "Path to include folder for doctest")
2424

2525
# --- Application executable ---
26-
add_executable(linecount src/main.cpp)
27-
install(TARGETS linecount RUNTIME DESTINATION bin)
26+
add_executable(aligncount_cpp src/main.cpp)
27+
install(TARGETS aligncount_cpp RUNTIME DESTINATION bin)
2828

2929
# --- Test executable ---
3030
# Make test executable
31-
add_executable(test_linecount tests/cpp/test_main.cpp)
32-
target_include_directories(test_linecount PUBLIC ${DOCTEST_INCLUDE_DIR})
31+
add_executable(test_aligncount_cpp tests/cpp/test_main.cpp)
32+
target_include_directories(test_aligncount_cpp PUBLIC ${DOCTEST_INCLUDE_DIR})
3333

34-
# Make test_linecount wait until doctest has finished downloading
35-
add_dependencies(test_linecount doctest)
34+
# Make test_aligncount_cpp wait until doctest has finished downloading
35+
add_dependencies(test_aligncount_cpp doctest)
3636

3737
enable_testing()
38-
add_test(NAME linecount_test COMMAND test_linecount)
38+
add_test(NAME aligncount_cpp_test COMMAND test_aligncount_cpp)

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ RUN pip3 install pytest
6565
RUN pytest -q /app/tests/python/test_cli.py
6666

6767
# 4) Verify the binaries are on PATH (just a check; you can remove)
68-
RUN which linecount && which aligncount
68+
RUN which aligncount_cpp && which aligncount
6969

7070
# Final entrypoint: run the Python wrapper by default
7171
ENTRYPOINT ["aligncount"]

cli/setup.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# cli/setup.py (pure-Python installer, uses setuptools + metadata from setup_common.cfg)
2+
3+
import os
4+
import configparser
5+
from setuptools import setup
6+
7+
# 1) Load the same shared INI file from the parent directory
8+
cfg = configparser.ConfigParser()
9+
cfg.read(os.path.join(os.path.dirname(__file__), "..", "setup.cfg"))
10+
11+
# 2) Extract metadata
12+
metadata = cfg["metadata"]
13+
options = cfg["options"]
14+
entry_points = {
15+
"console_scripts": [
16+
line.strip()
17+
for line in cfg["options.entry_points"]["console_scripts"].splitlines()
18+
if line.strip()
19+
]
20+
}
21+
22+
# 3) Call setuptools.setup() with that metadata
23+
setup(
24+
name=metadata["name"],
25+
version=metadata["version"],
26+
description=metadata["description"],
27+
python_requires=options["python_requires"],
28+
packages=["cli"], # finds cli/__init__.py and entrypoint.py
29+
entry_points=entry_points,
30+
)

conda-recipe/meta.yaml

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{% set REPO_NAME = environ.get('REPO_NAME', 'cpp-python-tool-template') %}
2-
{% set VERSION = environ.get('VERSION', '0.2.37') %}
3-
{% set TAR_URL = environ.get('TAR_URL', 'https://github.com/vr1087/cpp-python-tool-template/archive/refs/tags/v0.2.37.tar.gz') %}
4-
{% set SHA256 = environ.get('SHA256', 'c8bffc3e02bc465d0852fd124c354147a449b09e9847ff0ecaa747d083626f2a') %}
5-
{% set REPO_HOME = environ.get('REPO_HOME', 'https://github.com/vr1087/cpp-python-tool-template') %}
1+
{% set REPO_NAME = environ.get('REPO_NAME', '') %}
2+
{% set VERSION = environ.get('VERSION', '') %}
3+
{% set TAR_URL = environ.get('TAR_URL', '') %}
4+
{% set SHA256 = environ.get('SHA256', '') %}
5+
{% set REPO_HOME = environ.get('REPO_HOME', '') %}
66

77
package:
88
name: {{ REPO_NAME }}
@@ -22,22 +22,58 @@ build:
2222
cmake --build . --parallel ${CPU_COUNT:-1}
2323
cmake --install . --prefix $PREFIX
2424
cd ..
25-
{{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
2625
number: 0
2726

2827
requirements:
2928
build:
3029
- {{ compiler("cxx") }}
3130
- cmake
32-
- python
33-
- pip
34-
- setuptools
35-
- scikit-build
3631
host:
37-
- python
38-
- scikit-build
32+
# This environment only needs to run CMake and the C++ compiler
33+
- {{ compiler("cxx") }}
34+
- cmake
3935
run:
40-
- python
36+
# (only its C++ runtime, specified per‐output below)
37+
[]
38+
39+
outputs:
40+
# ---------------------------------------------------------
41+
# Output #1: Arch‐specific C++ executable (aligncount-cpp)
42+
# ---------------------------------------------------------
43+
- name: {{ name }}_cpp
44+
requirements:
45+
host:
46+
- {{ compiler("cxx") }}
47+
- cmake
48+
run:
49+
- {{ cdt("libcxx") }} # or libgcc-ng on Linux
50+
51+
# No separate script: top‐level build already installed
52+
# the C++ binary into $PREFIX/bin/aligncount_cpp
53+
54+
# ---------------------------------------------------------
55+
# Output #2: Noarch Python wrapper (aligncount_demo)
56+
# ---------------------------------------------------------
57+
- name: {{ name }}
58+
noarch: python
59+
60+
requirements:
61+
build:
62+
- python >=3.9,<3.14
63+
- pip
64+
- setuptools
65+
host:
66+
- python >=3.9,<3.14
67+
- pip
68+
- setuptools
69+
run:
70+
- python >=3.9,<3.14
71+
- {{ pin_subpackage(name + "_cpp", exact=True) }}
72+
73+
script: |
74+
cd cli
75+
$PYTHON -m pip install . --no-deps --ignore-installed --prefix=$PREFIX
76+
4177
4278
about:
4379
home: {{ REPO_HOME }}

pyproject.toml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
[build-system]
22
requires = [
3-
"setuptools>=42",
4-
"scikit-build>=0.13",
5-
"cmake>=3.18"
3+
"setuptools>=46",
4+
"scikit-build>=0.18",
5+
"cmake>=3.5"
66
]
7-
build-backend = "setuptools.build_meta"
8-
9-
[project]
10-
name = "aligncount_demo"
11-
version = "0.2.0"
12-
description = "Aligncount wrapper"
13-
14-
[project.scripts]
15-
aligncount = "cli.entrypoint:main"
7+
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
[metadata]
2-
name = aligncount_demo
3-
version = 0.1.0
4-
description = Aligncount wrapper
2+
name = aligncount
3+
version = 0.2.0
4+
description = Aligncount tool
55

66
[options]
7-
# Automatically find any packages under this directory (i.e. cli/)
87
packages = find:
8+
python_requires = >=3.9,<3.14
99

10-
# If you had data files, you could add:
11-
# include_package_data = True
12-
13-
[options.packages.find]
14-
# Only look for packages under the current directory
15-
where = .
10+
[options.entry_points]
11+
console_scripts =
12+
aligncount = cli.entrypoint:main

setup.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
# setup.py
1+
# setup.py (root, uses scikit-build + metadata from setup_common.cfg)
2+
3+
import os
4+
import configparser
25
from skbuild import setup
36

7+
# 1) Load the shared INI file
8+
cfg = configparser.ConfigParser()
9+
cfg.read(os.path.join(os.path.dirname(__file__), "setup.cfg"))
10+
11+
# 2) Extract metadata
12+
metadata = cfg["metadata"]
13+
options = cfg["options"]
14+
entry_points = {
15+
"console_scripts": [
16+
line.strip()
17+
for line in cfg["options.entry_points"]["console_scripts"].splitlines()
18+
if line.strip()
19+
]
20+
}
21+
22+
# 3) Call scikit-build’s setup(), passing exactly our shared metadata
423
setup(
5-
name="aligncount_demo",
6-
version="0.2.0",
7-
description="Aligncount wrapper",
8-
packages=["cli"],
9-
entry_points={"console_scripts": ["aligncount=cli.entrypoint:main"]},
24+
name=metadata["name"],
25+
version=metadata["version"],
26+
description=metadata["description"],
27+
python_requires=options["python_requires"],
28+
packages=["cli"], # “cli” is the only Python package at the root
29+
entry_points=entry_points,
1030
)

tests/cpp/test_main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ TEST_CASE("Count dummy SAM records") {
1010
f << "read2" << std::endl;
1111
f.close();
1212

13-
// run the linecount executable
14-
int rc = std::system("./linecount test.sam > out.txt");
13+
// run the aligncount_cpp executable
14+
int rc = std::system("./aligncount_cpp test.sam > out.txt");
1515
CHECK(rc == 0);
1616

1717
std::ifstream in("out.txt");

0 commit comments

Comments
 (0)