mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-10 19:07:11 +01:00
Run all 33 safe courses; fix what that broke
Running one directory (EADS) had already produced four bugs, so all of them
were run. 11 failed. Every one was real -- either in the coursework or in the
harness I had just written -- and the split was roughly even.
Coursework bugs:
- 15 .tex files use Polish ogonek characters with no fontenc, so pdflatex
dies with "Command \k unavailable in encoding OT1". Fixed where it was
actually needed, not blanket-applied.
- BSS had \documentclass{article}[12pt] -- options after the class name,
where they are not options at all.
- SDM's beamer deck had a stray } on an \item, which took out the frame.
- EOOP/Various/currency included "currency2.hpp"; the file is currency.hpp.
- ECRYPT_PROJECT had the SAME stdlib-shadowing bug as ECOTE: a package named
code/. Renamed to sieve/, and its 99 tests now run. With ECOTE's 26 that
is 125 tests that could not execute at all before today.
Harness bugs, which the run is what exposed:
- COURSE_ENTRY pointed at directories for PORR and ECRYPT_PROJECT, so python
looked for __main__.py and reported the wrong problem.
- main.py was auto-picked via find's first result. EARIN has six labs and
six main.py files, so that ran an arbitrary lab and called it the course.
Now only auto-picked when exactly one exists.
- Only the first requirements.txt was installed, which is why EARIN still
died on gymnasium after a venv was created for it. All of them now.
- The notebook probe accepted jupyter being on PATH. This machine's jupyter
is a pipx shim whose interpreter is gone, so "runnable" was a lie; it now
invokes jupyter --version and PBAD/twm_4 report blocked, honestly.
- Nothing ran a course's tests. Where a suite exists it is now the check,
which matters most for ECRYPT_PROJECT, whose program prompts on stdin and
cannot be run headlessly at all.
- Which directory pytest runs from is course-specific and unguessable, so
stubs pass --test-dir: ECOTE needs program/ for imports, ECRYPT_PROJECT
needs sieve/ because its fixtures open a CSV by relative path.
gates/known-incomplete.txt records the one file that genuinely cannot build:
EOOP/Various/set/set.cpp includes set.hpp, which `git log --all` shows has
never existed here. The course supplied it and only the .cpp was submitted.
That is a factual record with a stated check, not a lint allowlist -- and
fabricating the header would be inventing coursework.
Status is now 36 runnable / 5 no-code / 3 blocked.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172dj34FDpao6wsix8ZuCzE
This commit is contained in:
parent
e512bde26f
commit
a8d873b4fd
3
.gitignore
vendored
3
.gitignore
vendored
@ -486,3 +486,6 @@ build/
|
||||
# Generated fresh by the runner on each CI run. Committing a local copy
|
||||
# would label this machine capabilities as the runner is, which is a lie.
|
||||
gates/runnability-ci.tsv
|
||||
|
||||
# Per-course virtualenvs created by ./run.sh run.
|
||||
.venv/
|
||||
|
||||
@ -39,7 +39,7 @@ run cannot clobber the local column.
|
||||
| `Programming/ECOAR` | runnable | - | make |
|
||||
| `Programming/ECOTE` | runnable | - | python3 /home/kuhy/WUT_Computer_Science/Programming/ECOTE/program/translator/main.py |
|
||||
| `Programming/ECRYPT` | no-code | - | test1.py is a 0-byte stub; this course produced no submitted code |
|
||||
| `Programming/ECRYPT_PROJECT` | runnable | - | python3 /home/kuhy/WUT_Computer_Science/Programming/ECRYPT_PROJECT/code |
|
||||
| `Programming/ECRYPT_PROJECT` | runnable | - | python3 the entry script |
|
||||
| `Programming/EGUI` | runnable | - | dotnet build |
|
||||
| `Programming/EOOP` | runnable | - | compiles each standalone .cpp |
|
||||
| `Programming/EOPSY` | runnable | - | make |
|
||||
@ -47,12 +47,12 @@ run cannot clobber the local column.
|
||||
| `Programming/E-PSYOPS` | runnable | - | opens in the Unity editor |
|
||||
| `Programming/ERSMS-project` | runnable | - | docker compose up |
|
||||
| `Programming/NLP` | runnable | - | python3 the entry script |
|
||||
| `Programming/PBAD` | runnable | - | jupyter nbconvert --execute |
|
||||
| `Programming/PORR` | runnable | - | python3 /home/kuhy/WUT_Computer_Science/Programming/PORR/code |
|
||||
| `Programming/PBAD` | blocked | - | jupyter is on PATH but broken (bad interpreter) |
|
||||
| `Programming/PORR` | runnable | - | python3 /home/kuhy/WUT_Computer_Science/Programming/PORR/code/main.py |
|
||||
| `Programming/PSD` | runnable | - | starts the Kafka/Flink stack (installs packages with sudo) |
|
||||
| `Programming/psd_project` | runnable | - | mvn package |
|
||||
| `Programming/TRAK` | runnable | - | python3 the entry script |
|
||||
| `Programming/twm_4` | runnable | - | jupyter nbconvert --execute |
|
||||
| `Programming/twm_4` | blocked | - | jupyter is on PATH but broken (bad interpreter) |
|
||||
| `Programming/USD` | no-code | - | README describes a MetaDrive RL assignment; no implementation was submitted |
|
||||
| `Programming/WDWR` | runnable | - | python3 the entry script |
|
||||
| `Programming/ZPOB` | runnable | - | builds the report with latexmk |
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
\documentclass{report}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{pdfpages}
|
||||
|
||||
@ -300,7 +300,7 @@
|
||||
\item Intuicyjność
|
||||
\item Materiały
|
||||
\item Zasoby (Assety)
|
||||
\item Dostępne funkcje}
|
||||
\item Dostępne funkcje
|
||||
\item ChatGPT
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
\documentclass{beamer}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
|
||||
\usepackage[fontsize=20pt]{fontsize}
|
||||
\usepackage{graphicx}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
\documentclass[12pt]{article}
|
||||
\usepackage[polish]{babel}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{array}
|
||||
\usepackage{float}
|
||||
\usepackage{graphicx} % Add this line to include graphics
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
\documentclass[12pt]{extreport}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
|
||||
|
||||
\begin{document}
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
\documentclass[a4paper,12pt]{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
|
||||
% Packages
|
||||
\usepackage{amsmath, amssymb, amsthm} % For math symbols and theorems
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
\usepackage[left=0.75in,right=0.75in,bottom=0.75in]{geometry}
|
||||
\usepackage[polish]{babel}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{enumitem}
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
\documentclass{article}[12pt]
|
||||
% Options belong BEFORE the class name; this read
|
||||
% \documentclass{article}[12pt], where [12pt] is not a class option at all.
|
||||
\documentclass[12pt]{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{graphicx}
|
||||
|
||||
\title{[BSS]-Lab1-śr16-KrzysztofRudnicki}
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
\documentclass{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{listings}
|
||||
\usepackage{xcolor}
|
||||
\usepackage{graphicx}
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
\documentclass[12pt]{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{graphicx} % Required for inserting images
|
||||
\usepackage{hyperref}
|
||||
|
||||
|
||||
@ -9,4 +9,5 @@ set -euo pipefail
|
||||
|
||||
course_main --kind python \
|
||||
--entry "$(dirname "$(readlink -f "$0")")/program/translator/main.py" \
|
||||
--test-dir "$(dirname "$(readlink -f "$0")")/program" \
|
||||
-- "$@"
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
\documentclass[12pt]{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{float}
|
||||
|
||||
@ -7,6 +7,8 @@ set -euo pipefail
|
||||
# shellcheck source=../../scripts/course_lib.sh
|
||||
. "$(dirname "$(readlink -f "$0")")/../../scripts/course_lib.sh"
|
||||
|
||||
# No --entry on purpose: code/project.py prompts on stdin, so it cannot be run
|
||||
# headlessly. This course ships a real pytest suite, and that is the check.
|
||||
course_main --kind python \
|
||||
--entry "$(dirname "$(readlink -f "$0")")/code" \
|
||||
--test-dir "$(dirname "$(readlink -f "$0")")/sieve" \
|
||||
-- "$@"
|
||||
|
||||
|
Can't render this file because it is too large.
|
|
Can't render this file because it is too large.
|
@ -15,7 +15,7 @@
|
||||
g++ -Wall -Wextra -Werror -pedantic lab_2.cpp currency.hpp
|
||||
*/
|
||||
|
||||
#include "currency2.hpp"
|
||||
#include "currency.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
\documentclass{article}[11pt]
|
||||
\documentclass{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}[11pt]
|
||||
\usepackage{graphicx}
|
||||
\usepackage{float}
|
||||
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
\documentclass[12pt]{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{pgfplots}
|
||||
\usepgfplotslibrary{groupplots}
|
||||
\pgfplotsset{compat=1.17}
|
||||
|
||||
@ -8,5 +8,5 @@ set -euo pipefail
|
||||
. "$(dirname "$(readlink -f "$0")")/../../scripts/course_lib.sh"
|
||||
|
||||
course_main --kind python \
|
||||
--entry "$(dirname "$(readlink -f "$0")")/code" \
|
||||
--entry "$(dirname "$(readlink -f "$0")")/code/main.py" \
|
||||
-- "$@"
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
\documentclass[a4paper, 12pt]{article}
|
||||
\usepackage{graphicx}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[polish]{babel} % Add Polish language support
|
||||
|
||||
% Default fixed font does not support bold face
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
\documentclass[12pt]{article}
|
||||
\usepackage[polish]{babel}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amsfonts}
|
||||
\usepackage{amssymb}
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
\documentclass{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{polski}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{relsize,amsfonts}
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
\usepackage[polish]{babel}
|
||||
\usepackage[polish]{babel}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% T1 is required for Polish ogonek characters; without it pdflatex
|
||||
% fails with "Command \k unavailable in encoding OT1".
|
||||
\usepackage[T1]{fontenc}
|
||||
\author{Krzysztof Rudnicki, 307585}
|
||||
\title{ZBOP esej \\ Organizacja systemów produkcyjnych}
|
||||
\subtitle{ze względu na sposób spłenienia zapotrzebowania}
|
||||
|
||||
15
gates/known-incomplete.txt
Normal file
15
gates/known-incomplete.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Source files that cannot build because something they need was never
|
||||
# submitted. One repo-relative path per line, with the reason and how it was
|
||||
# checked above it.
|
||||
#
|
||||
# This is NOT a lint allowlist. Nothing here is a style exception; each entry
|
||||
# is a factual statement that a dependency is absent from the archive, and the
|
||||
# check is `git log --all -- <missing file>` coming back empty. Fabricating the
|
||||
# missing file would be inventing coursework that was never handed in.
|
||||
#
|
||||
# Read by scripts/course_lib.sh, which skips these and says why.
|
||||
|
||||
# Includes "set.hpp", which does not exist here and never has:
|
||||
# git log --all --name-only -- '*set.hpp' -> no results
|
||||
# The header was supplied by the course and only the .cpp was submitted.
|
||||
Programming/EOOP/Various/set/set.cpp
|
||||
@ -25,7 +25,7 @@ Programming/EARIN runnable python3 the entry script
|
||||
Programming/ECOAR runnable make
|
||||
Programming/ECOTE runnable python3 /home/kuhy/WUT_Computer_Science/Programming/ECOTE/program/translator/main.py
|
||||
Programming/ECRYPT no-code test1.py is a 0-byte stub; this course produced no submitted code
|
||||
Programming/ECRYPT_PROJECT runnable python3 /home/kuhy/WUT_Computer_Science/Programming/ECRYPT_PROJECT/code
|
||||
Programming/ECRYPT_PROJECT runnable python3 the entry script
|
||||
Programming/EGUI runnable dotnet build
|
||||
Programming/EOOP runnable compiles each standalone .cpp
|
||||
Programming/EOPSY runnable make
|
||||
@ -33,12 +33,12 @@ Programming/EPFU runnable make
|
||||
Programming/E-PSYOPS runnable opens in the Unity editor
|
||||
Programming/ERSMS-project runnable docker compose up
|
||||
Programming/NLP runnable python3 the entry script
|
||||
Programming/PBAD runnable jupyter nbconvert --execute
|
||||
Programming/PORR runnable python3 /home/kuhy/WUT_Computer_Science/Programming/PORR/code
|
||||
Programming/PBAD blocked jupyter is on PATH but broken (bad interpreter)
|
||||
Programming/PORR runnable python3 /home/kuhy/WUT_Computer_Science/Programming/PORR/code/main.py
|
||||
Programming/PSD runnable starts the Kafka/Flink stack (installs packages with sudo)
|
||||
Programming/psd_project runnable mvn package
|
||||
Programming/TRAK runnable python3 the entry script
|
||||
Programming/twm_4 runnable jupyter nbconvert --execute
|
||||
Programming/twm_4 blocked jupyter is on PATH but broken (bad interpreter)
|
||||
Programming/USD no-code README describes a MetaDrive RL assignment; no implementation was submitted
|
||||
Programming/WDWR runnable python3 the entry script
|
||||
Programming/ZPOB runnable builds the report with latexmk
|
||||
|
||||
|
@ -20,6 +20,9 @@ readonly COURSE_EXIT_NO_CODE=79
|
||||
|
||||
COURSE_ROOT="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[1]}")")" && pwd)"
|
||||
readonly COURSE_ROOT
|
||||
# Repo root is two levels up: every course dir is <repo>/<area>/<course>.
|
||||
COURSE_GATES="$(cd "${COURSE_ROOT}/../.." && pwd)/gates"
|
||||
readonly COURSE_GATES
|
||||
|
||||
# --- helpers -----------------------------------------------------------------
|
||||
|
||||
@ -65,6 +68,14 @@ _probe_any() {
|
||||
_blocked "needs $label (none of: $*)"
|
||||
}
|
||||
|
||||
# True if the path is recorded in gates/known-incomplete.txt.
|
||||
_is_known_incomplete() {
|
||||
local manifest="${COURSE_GATES:-}/known-incomplete.txt"
|
||||
[[ -f "$manifest" ]] || return 1
|
||||
local rel="$1"
|
||||
grep -vE '^\s*#|^\s*$' "$manifest" | grep -qxF "$rel"
|
||||
}
|
||||
|
||||
_first_file() {
|
||||
find "$COURSE_ROOT" -name "$1" -not -path '*/node_modules/*' -print -quit 2>/dev/null
|
||||
}
|
||||
@ -118,6 +129,10 @@ _probe() {
|
||||
;;
|
||||
notebook)
|
||||
_have jupyter || _blocked "needs jupyter"
|
||||
# Being on PATH is not the same as working: this machine has a
|
||||
# jupyter shim whose pipx venv interpreter is gone, so it fails
|
||||
# with "bad interpreter". Probe by actually invoking it.
|
||||
jupyter --version > /dev/null 2>&1 || _blocked "jupyter is on PATH but broken (bad interpreter)"
|
||||
_runnable "jupyter nbconvert --execute"
|
||||
;;
|
||||
compose)
|
||||
@ -129,6 +144,63 @@ _probe() {
|
||||
esac
|
||||
}
|
||||
|
||||
# Use the course venv when one exists, otherwise the system interpreter.
|
||||
_python_bin() {
|
||||
if [[ -x "$COURSE_ROOT/.venv/bin/python" ]]; then
|
||||
printf '%s' "$COURSE_ROOT/.venv/bin/python"
|
||||
else
|
||||
printf 'python3'
|
||||
fi
|
||||
}
|
||||
|
||||
# Dependencies are the runner's job, not the reader's. Without this, EARIN
|
||||
# dies on ModuleNotFoundError for gymnasium and the "runnable" status is a lie.
|
||||
_python_install_requirements() {
|
||||
local reqs=()
|
||||
while IFS= read -r r; do reqs+=("$r"); done < <(
|
||||
find "$COURSE_ROOT" -name 'requirements*.txt' -not -path '*/.venv/*' | sort)
|
||||
[[ ${#reqs[@]} -gt 0 ]] || return 0
|
||||
|
||||
if [[ ! -x "$COURSE_ROOT/.venv/bin/python" ]]; then
|
||||
printf 'creating .venv\n'
|
||||
python3 -m venv "$COURSE_ROOT/.venv"
|
||||
fi
|
||||
"$COURSE_ROOT/.venv/bin/python" -m pip install --quiet --upgrade pip
|
||||
|
||||
# EVERY requirements file, not just the first: EARIN is six independent
|
||||
# labs plus a project, and installing only one of them left the lab it
|
||||
# then tried to run missing gymnasium.
|
||||
local req
|
||||
for req in "${reqs[@]}"; do
|
||||
printf 'installing %s\n' "${req#"$COURSE_ROOT"/}"
|
||||
"$COURSE_ROOT/.venv/bin/python" -m pip install --quiet -r "$req" || {
|
||||
printf 'warning: some requirements in %s failed\n' "${req#"$COURSE_ROOT"/}" >&2
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
# Where a course ships real tests, running them is a stronger check than
|
||||
# running the program -- and for an interactive program (ECRYPT_PROJECT prompts
|
||||
# on stdin) it is the ONLY check that works without a person at a keyboard.
|
||||
_python_run_tests() {
|
||||
local suite
|
||||
suite="$(find "$COURSE_ROOT" -name 'test_*.py' -not -path '*/.venv/*' -print -quit 2>/dev/null)"
|
||||
[[ -n "$suite" ]] || return 0
|
||||
local py
|
||||
py="$(_python_bin)"
|
||||
"$py" -c 'import pytest' 2> /dev/null || {
|
||||
printf 'tests present but pytest is not installed; skipping\n'
|
||||
return 0
|
||||
}
|
||||
# Which directory pytest runs FROM is course-specific and cannot be
|
||||
# guessed: ECOTE needs program/ so `from translator.main import` resolves,
|
||||
# ECRYPT_PROJECT needs sieve/ because its fixtures open P-100000.csv by a
|
||||
# relative path. So the stub says, and COURSE_ROOT is only the default.
|
||||
local from_dir="${COURSE_TEST_DIR:-$COURSE_ROOT}"
|
||||
printf 'running the test suite in %s\n' "${from_dir#"$COURSE_ROOT"/}"
|
||||
( cd "$from_dir" && "$py" -m pytest -q )
|
||||
}
|
||||
|
||||
# --- runners -----------------------------------------------------------------
|
||||
|
||||
_run() {
|
||||
@ -156,9 +228,41 @@ _run() {
|
||||
;;
|
||||
python)
|
||||
local entry="${COURSE_ENTRY:-}"
|
||||
[[ -n "$entry" ]] || entry="$(_first_file 'main.py')"
|
||||
[[ -n "$entry" ]] || _no_code "no entry point; see this directory's README"
|
||||
( cd "$(dirname "$entry")" && python3 "$(basename "$entry")" )
|
||||
# An entry may be given as a directory; resolve it to the module
|
||||
# inside. Passing the directory itself makes python look for
|
||||
# __main__.py and fail with a message about the wrong thing.
|
||||
if [[ -d "$entry" ]]; then
|
||||
local cand
|
||||
for cand in main.py project.py __main__.py; do
|
||||
if [[ -f "$entry/$cand" ]]; then
|
||||
entry="$entry/$cand"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Only auto-pick a main.py when there is exactly ONE. A course
|
||||
# with six labs has six, and choosing whichever find returns first
|
||||
# is not "running the project", it is running an arbitrary lab.
|
||||
if [[ ! -f "$entry" ]]; then
|
||||
local mains
|
||||
mains="$(find "$COURSE_ROOT" -name 'main.py' -not -path '*/.venv/*' | wc -l)"
|
||||
[[ "$mains" -eq 1 ]] && entry="$(_first_file 'main.py')"
|
||||
fi
|
||||
|
||||
_python_install_requirements
|
||||
|
||||
if [[ -f "$entry" ]]; then
|
||||
( cd "$(dirname "$entry")" && "$(_python_bin)" "$(basename "$entry")" )
|
||||
else
|
||||
# A pile of one-shot scripts with no entry contract (NLP is
|
||||
# the case here). Syntax-check them all rather than picking one
|
||||
# arbitrarily and calling that "running the project".
|
||||
printf 'no single entry point; syntax-checking every module instead\n'
|
||||
find "$COURSE_ROOT" -name '*.py' -not -path '*/.venv/*' -print0 \
|
||||
| xargs -0 -r "$(_python_bin)" -m py_compile
|
||||
printf 'all modules compile\n'
|
||||
fi
|
||||
_python_run_tests
|
||||
;;
|
||||
node) ( cd "${COURSE_ENTRY:-$COURSE_ROOT}" && npm install && npm start ) ;;
|
||||
maven) ( cd "${COURSE_ENTRY:-$COURSE_ROOT}" && mvn -q package ) ;;
|
||||
@ -177,6 +281,10 @@ _run() {
|
||||
mkdir -p "$COURSE_ROOT/build"
|
||||
while IFS= read -r src; do
|
||||
rel="${src#"$COURSE_ROOT"/}"
|
||||
if _is_known_incomplete "${src#"${COURSE_GATES%/gates}"/}"; then
|
||||
printf 'skipping %s (see gates/known-incomplete.txt)\n' "$rel"
|
||||
continue
|
||||
fi
|
||||
out="$COURSE_ROOT/build/$(basename "${rel%.cpp}")"
|
||||
# Some files here are exam-answer fragments with no main(), so
|
||||
# they cannot be linked. Compile those to an object instead --
|
||||
@ -211,11 +319,13 @@ course_main() {
|
||||
COURSE_KIND=""
|
||||
COURSE_ENTRY=""
|
||||
COURSE_NOTE=""
|
||||
COURSE_TEST_DIR=""
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--kind) COURSE_KIND="$2"; shift 2 ;;
|
||||
--entry) COURSE_ENTRY="$2"; shift 2 ;;
|
||||
--note) COURSE_NOTE="$2"; shift 2 ;;
|
||||
--test-dir) COURSE_TEST_DIR="$2"; shift 2 ;;
|
||||
--) shift; break ;;
|
||||
*) break ;;
|
||||
esac
|
||||
|
||||
Loading…
Reference in New Issue
Block a user