wrap seafile-server-tools to use python dependencies

- also fix seahub dependencies
This commit is contained in:
Trolli Schmittlauch 2019-10-19 00:16:16 +02:00
parent e54c1770d1
commit fb48e3c568
2 changed files with 39 additions and 13 deletions

View file

@ -5,6 +5,13 @@
let let
version = "7.0.5"; version = "7.0.5";
python = python27;
pythonPackages = python27Packages;
seahubPythonDependencies = with pythonPackages; [
django pytz django-statici18n djangorestframework django_compressor
django-post_office django-constance gunicorn flup chardet dateutil six
openpyxl pysqlite jsonfield pillow
];
seafile-server-core = stdenv.mkDerivation rec { seafile-server-core = stdenv.mkDerivation rec {
name = "seafile-server-core"; name = "seafile-server-core";
inherit version; inherit version;
@ -17,19 +24,24 @@
# patch to work with latest, non-vulnerable libevhtp # patch to work with latest, non-vulnerable libevhtp
patches = [ patches = [
./recent_libevhtp.patch ./recent_libevhtp.patch
./django-version.patch
]; ];
# `which` is called directly from python during buildPhase, so we need the binary # `which` is called directly from python during buildPhase, so we need the binary
nativeBuildInputs = [ autoconf automake libtool pkgconfig vala autoreconfHook which ]; nativeBuildInputs = [ autoconf automake libtool pkgconfig vala autoreconfHook which pythonPackages.wrapPython ];
buildInputs = [ sqlite glib python27 libuuid openssl fuse libarchive ccnet-server libevent libsearpc libevhtp ]; buildInputs = [ sqlite glib python libuuid openssl fuse libarchive ccnet-server libevent libevhtp ];
propagatedBuildInputs = [ libsearpc ] ++ seahubPythonDependencies;
postFixup = ''
buildPythonPath $propagatedBuildInputs
wrapPythonProgramsIn "$out/bin" "$out $pythonPath"
'';
checkPhase = "bash ./run_tests.sh"; checkPhase = "bash ./run_tests.sh";
propagatedBuildInputs = [ python27Packages.django ];
meta = with lib; { meta = with lib; {
license = licenses.agpl3; # with additional OpenSSL linking exception license = licenses.agpl3; # with additional OpenSSL linking exception
maintainers = with maintainers; [ schmittlauch ]; maintainers = with maintainers; [ schmittlauch ];
}; };
}; };
seahub = python27Packages.buildPythonApplication rec { seahub = pythonPackages.buildPythonApplication rec {
name = "seahub"; name = "seahub";
inherit version; inherit version;
src = fetchFromGitHub { src = fetchFromGitHub {
@ -42,17 +54,13 @@
installPhase = '' installPhase = ''
cp -r ./ $out cp -r ./ $out
''; '';
propagatedBuildInputs = with python27Packages; [ propagatedBuildInputs = seahubPythonDependencies;
django pytz django-statici18n djangorestframework django_compressor
django-post_office django-constance gunicorn flup chardet dateutil six
openpyxl
];
meta = with lib; { meta = with lib; {
license = licenses.asl20; license = licenses.asl20;
maintainers = with maintainers; [ schmittlauch ]; maintainers = with maintainers; [ schmittlauch ];
}; };
}; };
django-constance = python27Packages.buildPythonPackage rec { django-constance = pythonPackages.buildPythonPackage rec {
pname = "django-constance"; pname = "django-constance";
version = "1.0.1"; version = "1.0.1";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -61,8 +69,8 @@
rev = "bde7f7c"; rev = "bde7f7c";
sha256 = "sha256:0m5hhylsrs6bn7ma04615r1n7jwykyw8kmbw1xqrkgxs259lm77h"; sha256 = "sha256:0m5hhylsrs6bn7ma04615r1n7jwykyw8kmbw1xqrkgxs259lm77h";
}; };
propagatedBuildInputs = with python27Packages; [ django ]; propagatedBuildInputs = with pythonPackages; [ django ];
checkInputs = [ python27Packages.redis python27Packages.coverage python27Packages.django-picklefield ]; checkInputs = [ pythonPackages.redis pythonPackages.coverage pythonPackages.django-picklefield ];
doCheck = false; # figure that out later doCheck = false; # figure that out later
meta = { meta = {
license = lib.licenses.bsd3; license = lib.licenses.bsd3;
@ -78,7 +86,7 @@
sha256 = "sha256:0mi0d2b4jwg511r0pp2ws9cw8ab6njplwy2a03wn6zi8q8fpjl38"; sha256 = "sha256:0mi0d2b4jwg511r0pp2ws9cw8ab6njplwy2a03wn6zi8q8fpjl38";
}; };
buildInputs = [ vala libsearpc libuuid sqlite openssl libevent glib python27 ] buildInputs = [ vala libsearpc libuuid sqlite openssl libevent glib python ]
++ lib.optional (!withMysql) "--without-mysql"; ++ lib.optional (!withMysql) "--without-mysql";
# `which` is called directly from python during buildPhase, so we need the binary # `which` is called directly from python during buildPhase, so we need the binary
nativeBuildInputs = [ autoconf automake libtool pkgconfig autoreconfHook which ]; nativeBuildInputs = [ autoconf automake libtool pkgconfig autoreconfHook which ];

View file

@ -0,0 +1,18 @@
diff --git a/tools/seafile-admin b/tools/seafile-admin
index 5e3658b..2fc2c08 100755
--- a/tools/seafile-admin
+++ b/tools/seafile-admin
@@ -518,10 +518,10 @@ def init_seahub():
def check_django_version():
- '''Requires django 1.8'''
+ '''Requires django 1.11 or later'''
import django
- if django.VERSION[0] != 1 or django.VERSION[1] != 8:
- error('Django 1.8 is required')
+ if django.VERSION[0] != 1 or django.VERSION[1] < 11:
+ error('Django 1.11+ is required')
del django