<commit_before>{ fetchurl, stdenv, buildPythonPackage, pygame, twisted, numeric, makeWrapper }:

buildPythonPackage rec {
  name = "castle-combat-0.8.1";
  namePrefix = "";

  src = fetchurl {
    url = "mirror://sourceforge/castle-combat/${name}.tar.gz";
    sha256 = "1hp4y5dgj88j9g44h4dqiakrgj8lip1krlrdl2qpffin08agrvik";
  };

  buildInputs = [ makeWrapper ];
  propagatedBuildInputs =
    [ pygame twisted

      # XXX: `Numeric.pth' should be found by Python but it's not.
      # Gobolinux has the same problem:
      # http://bugs.python.org/issue1431 .
      numeric
    ];

  patchPhase = ''
    sed -i "src/common.py" \
        -e "s|^data_path *=.*$|data_path = \"$out/share/${name}\"|g"

    mv -v "src/"*.py .
    sed -i "setup.py" -e's/"src"/""/g'
  '';

  postInstall = ''
    mkdir -p "$out/share/${name}"
    cp -rv "data/"* "$out/share/${name}"

    mv -v "$out/bin/castle-combat.py" "$out/bin/castle-combat"
  '';

  postPhases = "fixLoaderPath";

  fixLoaderPath =
    let dollar = "\$"; in
    '' sed -i "$out/bin/castle-combat" \
           -e "/^exec/ iexport LD_LIBRARY_PATH=\"$(cat ${stdenv.cc}/nix-support/orig-cc)/lib\:"'${dollar}'"LD_LIBRARY_PATH\"\\
export LD_LIBRARY_PATH=\"$(cat ${stdenv.cc}/nix-support/orig-cc)/lib64\:"'${dollar}'"LD_LIBRARY_PATH\""
    '';
      # ^
      # `--- The run-time says: "libgcc_s.so.1 must be installed for
      # pthread_cancel to work", which means it needs help to find it.

  # No test suite.
  doCheck = false;

  meta = {
    description = "Castle-Combat, a clone of the old arcade game Rampart";

    longDescription = ''
      Castle-Combat is a clone of the old arcade game Rampart.  Up to
      four players (or more in future versions) build castle walls,
      place cannons inside these walls, and shoot at the walls of
      their enemy(s).  If a player cannot build a complete wall around<commit_msg>castle_combat: mark as broken<commit_after>{ fetchurl, stdenv, buildPythonPackage, pygame, twisted, numeric, makeWrapper }:

buildPythonPackage rec {
  name = "castle-combat-0.8.1";
  namePrefix = "";

  src = fetchurl {
    url = "mirror://sourceforge/castle-combat/${name}.tar.gz";
    sha256 = "1hp4y5dgj88j9g44h4dqiakrgj8lip1krlrdl2qpffin08agrvik";
  };

  buildInputs = [ makeWrapper ];
  propagatedBuildInputs =
    [ pygame twisted

      # XXX: `Numeric.pth' should be found by Python but it's not.
      # Gobolinux has the same problem:
      # http://bugs.python.org/issue1431 .
      numeric
    ];

  patchPhase = ''
    sed -i "src/common.py" \
        -e "s|^data_path *=.*$|data_path = \"$out/share/${name}\"|g"

    mv -v "src/"*.py .
    sed -i "setup.py" -e's/"src"/""/g'
  '';

  postInstall = ''
    mkdir -p "$out/share/${name}"
    cp -rv "data/"* "$out/share/${name}"

    mv -v "$out/bin/castle-combat.py" "$out/bin/castle-combat"
  '';

  postPhases = "fixLoaderPath";

  fixLoaderPath =
    let dollar = "\$"; in
    '' sed -i "$out/bin/castle-combat" \
           -e "/^exec/ iexport LD_LIBRARY_PATH=\"$(cat ${stdenv.cc}/nix-support/orig-cc)/lib\:"'${dollar}'"LD_LIBRARY_PATH\"\\
export LD_LIBRARY_PATH=\"$(cat ${stdenv.cc}/nix-support/orig-cc)/lib64\:"'${dollar}'"LD_LIBRARY_PATH\""
    '';
      # ^
      # `--- The run-time says: "libgcc_s.so.1 must be installed for
      # pthread_cancel to work", which means it needs help to find it.

  # No test suite.
  doCheck = false;

  broken = true; # pygame.error: Unrecognized music format

  meta = {
    description = "Castle-Combat, a clone of the old arcade game Rampart";

    longDescription = ''
      Castle-Combat is a clone of the old arcade game Rampart.  Up to
      four players (or more in future versions) build castle walls,
      place cannons inside these walls, and shoot at the walls of
      their enemy(s).  If a player cannot build a complete wall around
{'fraction_non_alphanumeric': 0.1553701772679875, 'fraction_numerical': 0.014077163712200209, 'mean_word_length': 2.799009900990099, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4315526', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1359, 'n_words': 340}