Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amulet-map-editor: init at 0.10.37 #356035

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/licenses.nix
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ lib.mapAttrs mkLicense ({
fullName = "Academy of Motion Picture Arts and Sciences BSD";
};

amulet = {
fullName = "Amulet Team License 1.0.0";
url = "https://github.com/Amulet-Team/Amulet-NBT/blob/4.0/LICENSE";
free = false;
# Amulet Team License is based on Polyform Shield which allows non-competitive distribution
redistributable = true;
};

aom = {
fullName = "Alliance for Open Media Patent License 1.0";
url = "https://aomedia.org/license/patent-license/";
Expand Down
82 changes: 82 additions & 0 deletions pkgs/by-name/am/amulet-map-editor/package.nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also make this a python module and use python3Packages.toPythonApplication here -- which would help you avoid so many with python3.pkgs;, etc. Up to you though ;)

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
lib,
python3,
fetchFromGitHub,
nix-update-script,
wrapGAppsHook3,
gtk3,
}:
let
version = "0.10.39";
in
python3.pkgs.buildPythonApplication {
pname = "amulet-map-editor";
inherit version;
pyproject = true;

src = fetchFromGitHub {
owner = "Amulet-Team";
repo = "Amulet-Map-Editor";
tag = version;
hash = "sha256-6HwASoAi4amPTzAFnUTxn2PCzBRKi0wFXcTN1l10O8U=";
};

nativeBuildInputs = [ wrapGAppsHook3 ];

build-system = with python3.pkgs; [
setuptools
wheel
cython
versioneer
numpy
];

buildInputs = [ gtk3 ];

dependencies = with python3.pkgs; [
pillow
wxpython
pluiedev marked this conversation as resolved.
Show resolved Hide resolved
numpy
pyopengl
pluiedev marked this conversation as resolved.
Show resolved Hide resolved
packaging
amulet-core
amulet-nbt
pymctranslate
minecraft-resource-pack
platformdirs
];

pluiedev marked this conversation as resolved.
Show resolved Hide resolved
optional-dependencies = with python3.pkgs; {
dev = [
black
pre-commit
];
docs = [
sphinx
sphinx-autodoc-typehints
sphinx-rtd-theme
];
};

pythonRelaxDeps = [ "platformdirs" ];

preBuild = ''
export HOME=$(mktemp -d)
'';

pythonImportsCheck = [ "amulet_map_editor" ];
nativeCheckInputs = with python3.pkgs; [ pytestCheckHook ];

dontWrapGApps = true;
makeWrapperArgs = [ "\${gappsWrapperArgs[@]}" ];

passthru.updateScript = nix-update-script { };

meta = {
description = "Minecraft world editor and converter that supports all versions since Java 1.12 and Bedrock 1.7";
homepage = "https://github.com/Amulet-Team/Amulet-Map-Editor";
changelog = "https://github.com/Amulet-Team/Amulet-Map-Editor/releases/tag/${version}";
license = with lib.licenses; [ amulet ];
maintainers = with lib.maintainers; [ pluiedev ];
};
}
105 changes: 105 additions & 0 deletions pkgs/development/python-modules/amulet-core/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,

# build-system
setuptools,
wheel,
cython,
versioneer,
numpy,

# dependencies
amulet-nbt,
pymctranslate,
portalocker,
amulet-leveldb,
platformdirs,
lz4,
black,
pre-commit,
sphinx,
sphinx-autodoc-typehints,
sphinx-rtd-theme,

pytestCheckHook,
nix-update-script,
}:
let
version = "1.9.27";
in
buildPythonPackage {
pname = "amulet-core";
inherit version;
pyproject = true;

src = fetchFromGitHub {
owner = "Amulet-Team";
repo = "Amulet-Core";
tag = version;
hash = "sha256-cwk70qg97BIFPTpBnGG5WQElzvS5CYP5HIEIYd0w96I=";
};

disabled = pythonOlder "3.9";

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'versioneer-518' 'versioneer'

substituteInPlace setup.py \
--replace-fail "versioneer.get_version()" "'${version}'"
'';

build-system = [
setuptools
wheel
cython
versioneer
numpy
];

dependencies = [
numpy
amulet-nbt
pymctranslate
portalocker
amulet-leveldb
platformdirs
lz4
];

pluiedev marked this conversation as resolved.
Show resolved Hide resolved
optional-dependencies = {
dev = [
black
pre-commit
];
docs = [
sphinx
sphinx-autodoc-typehints
sphinx-rtd-theme
];
};

pythonRelaxDeps = [ "platformdirs" ];

pythonImportsCheck = [ "amulet" ];

nativeCheckInputs = [ pytestCheckHook ];

preCheck = ''
# Required for tests that want to write to the home directory
export HOME=$(mktemp -d)
'';

passthru.updateScript = nix-update-script { };

meta = {
description = "Python library for reading and writing the Minecraft save formats";
homepage = "https://github.com/Amulet-Team/Amulet-Core";
changelog = "https://github.com/Amulet-Team/Amulet-Core/releases/tag/${version}";
license = with lib.licenses; [ amulet ];
maintainers = with lib.maintainers; [ pluiedev ];
};
}
90 changes: 90 additions & 0 deletions pkgs/development/python-modules/amulet-leveldb/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
zlib,

# build-system
setuptools,
wheel,
cython,
versioneer,
black,
pre-commit,
sphinx,
sphinx-autodoc-typehints,
sphinx-rtd-theme,

pytestCheckHook,
nix-update-script,
}:
let
version = "1.0.2";
in
buildPythonPackage {
pname = "amulet-leveldb";
inherit version;
pyproject = true;

src = fetchFromGitHub {
owner = "Amulet-Team";
repo = "Amulet-LevelDB";
tag = version;
hash = "sha256-7VJb5TEa3GcwNEZYrnwP3yMWdpxkHeFcydCCeHiB3+w=";

postFetch = ''
# De-vendor zlib
rm -r $out/zlib
'';
fetchSubmodules = true;
};

disabled = pythonOlder "3.8";

postPatch = ''
substituteInPlace setup.py \
--replace-fail "versioneer.get_version()" "'${version}'"
'';

build-system = [
setuptools
wheel
cython
versioneer
];

buildInputs = [ zlib ];

optional-dependencies = {
dev = [
black
pre-commit
];
docs = [
sphinx
sphinx-autodoc-typehints
sphinx-rtd-theme
];
};

pluiedev marked this conversation as resolved.
Show resolved Hide resolved
pythonImportsCheck = [ "leveldb" ];

nativeCheckInputs = [ pytestCheckHook ];

# FIXME(pluiedev): I... frankly don't know why this fails.
# try:
# self.assertTrue(40_000 <= len(list(db.keys())) < 100_000)
# ^ AssertionError: False is not true
disabledTests = [ "test_corrupt" ];

passthru.updateScript = nix-update-script { };

meta = {
description = "Cython wrapper for Mojang's custom LevelDB";
homepage = "https://github.com/Amulet-Team/Amulet-LevelDB";
changelog = "https://github.com/Amulet-Team/Amulet-LevelDB/releases/tag/${version}";
license = with lib.licenses; [ amulet ];
maintainers = with lib.maintainers; [ pluiedev ];
};
}
97 changes: 97 additions & 0 deletions pkgs/development/python-modules/amulet-nbt/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,

# build-system
setuptools,
wheel,
versioneer,
cython,

# dependencies
numpy,
mutf8,
black,
pre-commit,
sphinx,
sphinx-autodoc-typehints,
sphinx-rtd-theme,

pytestCheckHook,
nix-update-script,
}:
let
version = "2.1.3";
in
buildPythonPackage {
pname = "amulet-nbt";
inherit version;
pyproject = true;

src = fetchFromGitHub {
owner = "Amulet-Team";
repo = "Amulet-NBT";
tag = version;
hash = "sha256-ucN/CFPYWEPPiqrK9v2VZ1l5s2jf0N0tNuxpYoTZQ4s=";
};

disabled = pythonOlder "3.9";

postPatch = ''
# FIXME: Drop for 4.x
substituteInPlace pyproject.toml \
--replace-fail 'versioneer-518' 'versioneer'

substituteInPlace setup.py \
--replace-fail "versioneer.get_version()" "'${version}'"
'';

build-system = [
setuptools
wheel
cython
versioneer
numpy
];

dependencies = [
numpy
mutf8
];

pluiedev marked this conversation as resolved.
Show resolved Hide resolved
optional-dependencies = {
dev = [
black
pre-commit
];
docs = [
sphinx
sphinx-autodoc-typehints
sphinx-rtd-theme
];
};

pythonImportsCheck = [ "amulet_nbt" ];

nativeCheckInputs = [ pytestCheckHook ];

# Source files interfere with tests :(
preCheck = ''
rm -r amulet_nbt
'';

# FIXME: Drop for 4.x, somehow it's just not implemented at all
disabledTestPaths = [ "tests/base_type_test.py" ];

passthru.updateScript = nix-update-script { };

meta = {
description = "Python library for reading and writing binary NBT and stringified NBT";
homepage = "https://github.com/Amulet-Team/Amulet-NBT";
changelog = "https://github.com/Amulet-Team/Amulet-NBT/releases/tag/${version}";
license = with lib.licenses; [ amulet ];
maintainers = with lib.maintainers; [ pluiedev ];
};
}
Loading
Loading