parent
9d48da02b8
commit
c5b5eb26db
1 changed files with 41 additions and 25 deletions
|
@ -5,6 +5,8 @@
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
python,
|
python,
|
||||||
# deps
|
# deps
|
||||||
|
rar,
|
||||||
|
# python deps
|
||||||
aiohttp,
|
aiohttp,
|
||||||
beautifulsoup4,
|
beautifulsoup4,
|
||||||
bencoding, # from overrides
|
bencoding, # from overrides
|
||||||
|
@ -19,11 +21,14 @@
|
||||||
waitress,
|
waitress,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib) getExe;
|
||||||
|
|
||||||
pname = "kapowarr";
|
pname = "kapowarr";
|
||||||
version = "1.1.1";
|
version = "1.1.1";
|
||||||
in
|
in
|
||||||
buildPythonApplication {
|
buildPythonApplication {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
|
format = "pyproject";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "Casvt";
|
owner = "Casvt";
|
||||||
|
@ -35,6 +40,12 @@ in
|
||||||
patches = [./raise-errors.patch];
|
patches = [./raise-errors.patch];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
# FIXME: THIS DOESN'T WORK
|
||||||
|
substituteInPlace ./backend/implementations/converters.py \
|
||||||
|
--replace-fail \
|
||||||
|
"exe = folder_path('backend', 'lib', Constants.RAR_EXECUTABLES[platform])" \
|
||||||
|
"exe = '${getExe rar}'"
|
||||||
|
|
||||||
# Insert import for following substituteInPlace
|
# Insert import for following substituteInPlace
|
||||||
sed -i '/# -\*- coding: utf-8 -\*-/a from os import environ' ./backend/base/logging.py
|
sed -i '/# -\*- coding: utf-8 -\*-/a from os import environ' ./backend/base/logging.py
|
||||||
|
|
||||||
|
@ -80,30 +91,38 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
cat > setup.py << EOF
|
sed -i "s/bs4.*/beautifulsoup4 ~= 4.12.3/" requirements.txt
|
||||||
from setuptools import setup, find_packages, find_namespace_packages
|
|
||||||
|
|
||||||
with open('requirements.txt') as f:
|
cat >> pyproject.toml << EOF
|
||||||
install_requires = f.read().splitlines()
|
|
||||||
|
|
||||||
setup(
|
[build-system]
|
||||||
name='${pname}',
|
build-backend = "setuptools.build_meta"
|
||||||
version = '${version}',
|
requires = ["setuptools"]
|
||||||
install_requires=install_requires,
|
|
||||||
packages=[
|
[project]
|
||||||
'frontend',
|
name = "${pname}"
|
||||||
'backend',
|
version = "${version}"
|
||||||
'backend.base',
|
dynamic = ["dependencies"]
|
||||||
'backend.features',
|
|
||||||
'backend.implementations',
|
[tool.setuptools]
|
||||||
'backend.implementations.torrent_clients',
|
script-files = ["Kapowarr.py"]
|
||||||
'backend.internals',
|
py-modules = [
|
||||||
'backend.lib',
|
"Kapowarr",
|
||||||
],
|
]
|
||||||
scripts=[
|
packages = [
|
||||||
'Kapowarr.py'
|
"frontend",
|
||||||
],
|
"frontend.static",
|
||||||
)
|
"backend",
|
||||||
|
"backend.base",
|
||||||
|
"backend.features",
|
||||||
|
"backend.implementations",
|
||||||
|
"backend.implementations.torrent_clients",
|
||||||
|
"backend.internals",
|
||||||
|
"backend.lib",
|
||||||
|
]
|
||||||
|
package-data."frontend" = [ "templates/*" ]
|
||||||
|
package-data."frontend.static" = [ "css/*", "img/*", "js/*", "json/*" ]
|
||||||
|
dynamic."dependencies".file = [ "requirements.txt" ]
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -134,9 +153,6 @@ in
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
# I prefer a clean name for the executable
|
# I prefer a clean name for the executable
|
||||||
mv $out/bin/Kapowarr.py $out/bin/${pname}
|
mv $out/bin/Kapowarr.py $out/bin/${pname}
|
||||||
|
|
||||||
# Add missing resources that Kapowarr uses at runtime in sitePackages
|
|
||||||
cp -r ./frontend/{static,templates} "$out/${python.sitePackages}/frontend"
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue