DevPlace CI / test (push) Failing after 44m45s
Continuous Delivery could never be turned off once a crop was planted. Add a one-shot per-plot "stop after harvest" flag (POST /game/plot/stop, Devii tool game_plot_stop, game_plots.stop_after_harvest), cleared by the next plant, autoreplant claim or Refactor. Autoreplant now also respects crop locks through the shared _crop_lock predicate. Plan and measurements in happyplanting.md. Also includes the pending community sync, node network and related work in the tree; the full suite passed (4999) with all of it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
# retoor <retoor@molodetz.nl>
|
|
|
|
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
from types import ModuleType
|
|
|
|
from devplacepy import config
|
|
from devplacepy.services.community.generator import CodeGenerator
|
|
|
|
|
|
class CommunityFiles:
|
|
def __init__(self, root: Path | None = None):
|
|
self.root = root
|
|
|
|
def directory(self, slug: str) -> Path:
|
|
return (self.root or config.COMMUNITIES_DIR) / slug
|
|
|
|
def collectors_path(self, slug: str) -> Path:
|
|
return self.directory(slug) / "collectors.py"
|
|
|
|
def write(self, slug: str, schema: dict) -> Path:
|
|
return CodeGenerator(schema).write(self.directory(slug))
|
|
|
|
def load(self, slug: str, schema: dict) -> ModuleType:
|
|
path = self.collectors_path(slug)
|
|
if not path.exists():
|
|
self.write(slug, schema)
|
|
else:
|
|
source = path.read_text()
|
|
if not CodeGenerator.is_current(source):
|
|
self.write(slug, CodeGenerator.embedded_schema(source) or schema)
|
|
spec = importlib.util.spec_from_file_location(f"community_collectors_{slug.replace('-', '_')}", path)
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
def read(self, slug: str) -> str:
|
|
path = self.collectors_path(slug)
|
|
return path.read_text() if path.exists() else ""
|
|
|
|
|
|
files = CommunityFiles()
|