Skip to content

Commit 46b3704

Browse files
committed
Try to skip python
1 parent 2b5403d commit 46b3704

3 files changed

Lines changed: 58 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install CI dependencies
3030
run: |
3131
apt-get update
32-
apt-get install -y python3 python-is-python3 libboost-dev
32+
apt-get install -y libboost-dev
3333
3434
- name: Build
3535
shell: bash

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
## Unreleased
4+
5+
### For developers
6+
- `Allwmake` now supports a Python-free version-header generation path for
7+
ESI/OpenCFD builds by inferring release information from
8+
`WM_PROJECT_VERSION` when `META-INFO` is unavailable.
9+
310
## v0.8.0
411

512
### For users
@@ -29,6 +36,8 @@
2936
- The Newton, Bisection and TOMS748 root finders now use `boost`
3037
implementations behind the scenes.
3138

39+
- Switched CI provider to Github Actions.
40+
3241

3342
## v0.7.0
3443

versionRules/createVersionRules.sh

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,76 @@
1616
#
1717
#-------------------------------------------------------------------------------
1818
unset api patch
19+
unset major minor isComValue openfoamCom
1920

20-
[ -d "${WM_PROJECT_DIR:-/dev/null}" ] || {
21-
echo "Invalid WM_PROJECT_DIR ${WM_PROJECT_DIR:-[]}" 1>&2
22-
exit 2
23-
}
24-
25-
if [ -d "$WM_PROJECT_DIR/META-INFO" ]
26-
then
27-
# openfoam.com
28-
# - simply use foamEtcFile to extract api,patch information
29-
30-
api="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-api)"
31-
patch="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-patch)"
32-
33-
echo "OpenFOAM (com) - api=$api patch=$patch" 1>&2
34-
21+
emit_header()
22+
{
3523
cat << VERSION_HEADER
3624
// OpenFOAM versions information
3725
// generated by the Allwmake-script of the libWallModelledLES-distro
3826
#ifndef foamVersion4wmles_H
3927
#define foamVersion4wmles_H
4028
4129
#define FOAM_VERSION4WMLES_FORK com /* unused */
42-
#define FOAM_VERSION4WMLES_MAJOR $api
43-
#define FOAM_VERSION4WMLES_MINOR 0
30+
#define FOAM_VERSION4WMLES_MAJOR $major
31+
#define FOAM_VERSION4WMLES_MINOR $minor
4432
#define FOAM_VERSION4WMLES_PATCH 0
4533
#define FOAM_VERSION4WMLES_PATCH_NUM 0
4634
47-
#define FOAM_VERSION4WMLES_IS_COM $api
35+
#define FOAM_VERSION4WMLES_IS_COM $isComValue
4836
#undef FOAM_VERSION4WMLES_IS_ORG
4937
#undef FOAM_VERSION4WMLES_IS_EXTEND
5038
5139
// OPENFOAM_COM is the release date (YYMM) as an integer
5240
#ifndef OPENFOAM_COM
53-
# define OPENFOAM_COM $api
41+
# define OPENFOAM_COM $openfoamCom
5442
#endif
5543
5644
#endif /* foamVersion4wmles_H */
5745
VERSION_HEADER
46+
}
47+
48+
[ -d "${WM_PROJECT_DIR:-/dev/null}" ] || {
49+
echo "Invalid WM_PROJECT_DIR ${WM_PROJECT_DIR:-[]}" 1>&2
50+
exit 2
51+
}
52+
53+
if [ -d "$WM_PROJECT_DIR/META-INFO" ]
54+
then
55+
# openfoam.com
56+
# - simply use foamEtcFile to extract api,patch information
57+
58+
api="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-api)"
59+
patch="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-patch)"
60+
61+
echo "OpenFOAM (com) - api=$api patch=$patch" 1>&2
62+
major="$api"
63+
minor=0
64+
isComValue="$api"
65+
openfoamCom="$api"
66+
emit_header
5867

5968
else
60-
echo "Not an OpenFOAM.com version - revert to parsing version number" 1>&2
61-
exit 1
69+
# Python-free fallback for installations where META-INFO is unavailable.
70+
# Assume an OpenCFD version using the vYYMM naming convention and
71+
# infer enough information from WM_PROJECT_VERSION for the library rules.
72+
case "${WM_PROJECT_VERSION:-}" in
73+
v[0-9][0-9][0-9][0-9])
74+
api="${WM_PROJECT_VERSION#v}"
75+
major="$api"
76+
minor=0
77+
isComValue="$api"
78+
openfoamCom="$api"
79+
;;
80+
*)
81+
echo "Unable to infer OpenFOAM.com version from WM_PROJECT_VERSION='${WM_PROJECT_VERSION:-}'" 1>&2
82+
echo "Expected an ESI/OpenCFD version in the form vYYMM, for example v2512." 1>&2
83+
exit 1
84+
;;
85+
esac
86+
87+
echo "OpenFOAM (com) - inferred from WM_PROJECT_VERSION=${WM_PROJECT_VERSION:-[]} as OPENFOAM_COM=$openfoamCom" 1>&2
88+
emit_header
6289
fi
6390

6491
exit 0

0 commit comments

Comments
 (0)