From 9b3ba167555c1e8726e8683c4124208fece0b13b Mon Sep 17 00:00:00 2001
From: lukken <lukken@astron.nl>
Date: Thu, 17 Apr 2025 13:07:23 +0200
Subject: [PATCH] Adress review comments

---
 {{cookiecutter.project_slug}}/.pre-commit-config.yaml       | 1 +
 {{cookiecutter.project_slug}}/CMakeLists.txt                | 3 ---
 {{cookiecutter.project_slug}}/docker/ci-runner/Dockerfile   | 3 ++-
 .../docker/{{cookiecutter.project_slug}}/Dockerfile         | 5 +++++
 {{cookiecutter.project_slug}}/docs/cleanup.py               | 6 +++++-
 {{cookiecutter.project_slug}}/setup.sh                      | 4 +++-
 6 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
index ce46e64..c6570e2 100644
--- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
+++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
@@ -1,3 +1,4 @@
+# https://pre-commit.com/
 default_stages: [ pre-commit, pre-push ]
 default_language_version:
   python: python3
diff --git a/{{cookiecutter.project_slug}}/CMakeLists.txt b/{{cookiecutter.project_slug}}/CMakeLists.txt
index 3b8b18d..ce8b8df 100644
--- a/{{cookiecutter.project_slug}}/CMakeLists.txt
+++ b/{{cookiecutter.project_slug}}/CMakeLists.txt
@@ -6,9 +6,6 @@ set(
     "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake-extra-utils/cmake"
 )
 
-set(LARGEFILE_SOURCE)
-set(FILE_OFFSET_BITS 64)
-
 # Include script
 include(DynamicVersion)
 dynamic_version(
diff --git a/{{cookiecutter.project_slug}}/docker/ci-runner/Dockerfile b/{{cookiecutter.project_slug}}/docker/ci-runner/Dockerfile
index c984a99..d61c399 100644
--- a/{{cookiecutter.project_slug}}/docker/ci-runner/Dockerfile
+++ b/{{cookiecutter.project_slug}}/docker/ci-runner/Dockerfile
@@ -1,4 +1,5 @@
 FROM python:3.13
 
-RUN python -m pip install --upgrade cibuildwheel==2.23.0 pip tox twine
+RUN python -m pip install --upgrade pip
+RUN python -m pip install --upgrade cibuildwheel==2.23.0 tox twine
 RUN curl -sSL https://get.docker.com/ | sh
diff --git a/{{cookiecutter.project_slug}}/docker/{{cookiecutter.project_slug}}/Dockerfile b/{{cookiecutter.project_slug}}/docker/{{cookiecutter.project_slug}}/Dockerfile
index 1f7eb27..d64db49 100644
--- a/{{cookiecutter.project_slug}}/docker/{{cookiecutter.project_slug}}/Dockerfile
+++ b/{{cookiecutter.project_slug}}/docker/{{cookiecutter.project_slug}}/Dockerfile
@@ -1,5 +1,6 @@
 ARG BUILD_ENV=no_copy
 
+# Build without copying from host inside docker
 FROM python:3.13 AS build_no_copy
 ADD ../../requirements.txt .
 COPY ../.. /work
@@ -8,11 +9,15 @@ RUN python -m pip install --user tox
 WORKDIR /work
 RUN python -m tox -e build
 
+# Copy build package from host `dist` directory
 FROM python:3.13 AS build_copy
 COPY dist /work/dist
 
+# Dynamically set `build` from `build_no_copy` or `build_copy` depending on
+# `BUILD_ENV` argument
 FROM build_${BUILD_ENV} AS build
 
+# Copy build stage files into final python slim image and install
 FROM python:3.13-slim
 COPY --from=build /work/dist /dist
 RUN python -m pip install /dist/*.whl
diff --git a/{{cookiecutter.project_slug}}/docs/cleanup.py b/{{cookiecutter.project_slug}}/docs/cleanup.py
index 3a4508d..b2e219c 100644
--- a/{{cookiecutter.project_slug}}/docs/cleanup.py
+++ b/{{cookiecutter.project_slug}}/docs/cleanup.py
@@ -3,6 +3,10 @@
 #  Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
 #  SPDX-License-Identifier: Apache-2.0
 
+"""
+Remove generated source documentation files except for index.rst
+"""
+
 import os
 
 file_dir = os.path.dirname(os.path.realpath(__file__))
@@ -15,7 +19,7 @@ if not os.path.exists(clean_dir):
 
 for file_name in os.listdir(clean_dir):
     file = os.path.join(clean_dir, file_name)
-    
+
     if file_name == "index.rst":
         continue
 
diff --git a/{{cookiecutter.project_slug}}/setup.sh b/{{cookiecutter.project_slug}}/setup.sh
index 4548910..3eb7429 100755
--- a/{{cookiecutter.project_slug}}/setup.sh
+++ b/{{cookiecutter.project_slug}}/setup.sh
@@ -5,7 +5,9 @@
 #
 
 # This file's directory is used to determine the station control directory
-# location.
+# location. We substitute BASH_SOURCE if it doesn't get set, this particularly
+# happens when sourcing using the `docker` docker image due to its primitive
+# shell.
 if [ -z ${BASH_SOURCE} ]; then
   BASH_SOURCE=${(%):-%x}
 fi
-- 
GitLab