Skip to content
Open
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
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,56 @@ jobs:
./TestLiteralEvalCpp
g++ -std=c++11 -I. -o TestConcoreHpp TestConcoreHpp.cpp
./TestConcoreHpp

package:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Build sdist and wheel
run: |
pip install build twine
python -m build
twine check dist/*

- name: Install the wheel into a clean virtual environment
run: |
python -m venv "$RUNNER_TEMP/venv"
"$RUNNER_TEMP/venv/bin/pip" install dist/*.whl

- name: Check mkconcore's runtime files are in the installed package
run: |
cd "$RUNNER_TEMP"
"$RUNNER_TEMP/venv/bin/python" - <<'PY'
import importlib.util, os, re, sys

repo = os.environ["GITHUB_WORKSPACE"]
installed = os.path.dirname(importlib.util.find_spec("mkconcore").origin)
source = open(os.path.join(installed, "mkconcore.py")).read()
names = set(re.findall(r'CONCOREPATH\s*\+\s*"/([^"]+)"', source))
names |= set(re.findall(r'os\.path\.join\(CONCOREPATH,\s*"([^"]+)"', source))
# Only files that exist in the repo are expected in the package.
missing = sorted(
n for n in names
if os.path.exists(os.path.join(repo, n))
and not os.path.exists(os.path.join(installed, n))
)
if missing:
sys.exit("Referenced by mkconcore.py but missing from the wheel: " + ", ".join(missing))
print(f"OK: {len(names)} files referenced, none missing from the wheel")
PY

- name: Build studies with the installed concore command
run: |
cd "$RUNNER_TEMP"
"$RUNNER_TEMP/venv/bin/concore" init proj
"$RUNNER_TEMP/venv/bin/concore" build proj/workflow.graphml --source proj/src --output posix-out --type posix
"$RUNNER_TEMP/venv/bin/concore" build proj/workflow.graphml --source proj/src --output docker-out --type docker
"$RUNNER_TEMP/venv/bin/concore" build "$GITHUB_WORKSPACE/testsou/testSM1.graphml" --source "$GITHUB_WORKSPACE/testsou" --output cpp-out --type posix
test -f cpp-out/src/concore.hpp
test -f docker-out/src/Dockerfile.script
10 changes: 10 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Runtime files mkconcore.py copies into generated studies (see setup.py).
include concore*.hpp concore*.v concore*.java ConcoreJavaRuntimeCore.java
include concore*.jl
include concore_default_maxtime.m concore_initval.m concore_iport.m
include concore_literal_eval.m concore_literal_serialize.m concore_oport.m
include concore_read.m concore_unchanged.m concore_write.m
include import_concore.m import_concoredocker.m
include Dockerfile.* mkcompile
include concore.octave concore.mcr concore.sudo concore.repo concore.tools
include tools/extract_graphml.py
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ concore = "concore_cli.cli:cli"

[tool.setuptools]
packages = ["concore_cli", "concore_cli.commands"]
py-modules = ["concore", "concoredocker", "concore_base", "mkconcore"]
py-modules = [
"concore",
"concoredocker",
"concore_base",
"mkconcore",
"copy_with_port_portname",
]

[tool.setuptools.dynamic]
version = {attr = "concore_cli.__version__"}
55 changes: 52 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
import glob
import os

from setuptools import setup
from setuptools.command.build_py import build_py

# Files mkconcore.py reads from next to itself (CONCOREPATH) and copies into
# every generated study. They are not Python modules, so setuptools would
# otherwise leave them out of the wheel and `concore build` could not work
# from a regular (non-editable) install. Keep MANIFEST.in in sync.
RUNTIME_FILE_PATTERNS = [
"concore*.hpp",
"concore*.v",
"concore*.java",
"ConcoreJavaRuntimeCore.java",
"concore*.jl",
"concore_default_maxtime.m",
"concore_initval.m",
"concore_iport.m",
"concore_literal_eval.m",
"concore_literal_serialize.m",
"concore_oport.m",
"concore_read.m",
"concore_unchanged.m",
"concore_write.m",
"import_concore.m",
"import_concoredocker.m",
"Dockerfile.*",
"mkcompile",
"concore.octave",
"concore.mcr",
"concore.sudo",
"concore.repo",
"concore.tools",
"tools/extract_graphml.py",
]


class build_py_with_runtime_files(build_py):
"""Install the runtime files next to mkconcore.py in the built package."""

def run(self):
super().run()
if self.dry_run:
return
for pattern in RUNTIME_FILE_PATTERNS:
for src in sorted(glob.glob(pattern)):
dest = os.path.join(self.build_lib, src)
self.mkpath(os.path.dirname(dest))
self.copy_file(src, dest)


# All metadata and configuration is in pyproject.toml.
# This file exists only for legacy compatibility.
setup()
# All other metadata and configuration is in pyproject.toml.
setup(cmdclass={"build_py": build_py_with_runtime_files})
Loading