Unverified Commit 1ce2122b authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

python3Packages.django_3: drop (#376781)

parents 189f817a fa497de0
Loading
Loading
Loading
Loading
+0 −120
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  python3,
  fetchFromGitHub,
  fetchPypi,
  curl,
  wget,
  git,
  ripgrep,
  single-file-cli,
  postlight-parser,
  readability-extractor,
  chromium,
}:

let
  python = python3.override {
    self = python;
    packageOverrides = self: super: {
      django = super.django_3.overridePythonAttrs (old: rec {
        version = "3.1.14";
        src = old.src.override {
          inherit version;
          hash = "sha256-cqSloTaiFMOc8BbM3Wtp4qoIx0ecZtk/OpteS7nYo0c=";
        };
        meta = old.meta // {
          knownVulnerabilities = [
            "CVE-2021-45115"
            "CVE-2021-45116"
            "CVE-2021-45452"
            "CVE-2022-23833"
            "CVE-2022-22818"
            "CVE-2022-28347"
            "CVE-2022-28346"
          ];
        };
        dependencies =
          (old.dependencies or [ ])
          ++ (lib.optionals (python.pythonAtLeast "3.12") [ python.pkgs.distutils ]);
      });
      django-extensions = super.django-extensions.overridePythonAttrs (old: rec {
        version = "3.1.5";
        src = fetchFromGitHub {
          inherit version;
          owner = "django-extensions";
          repo = "django-extensions";
          rev = "e43f383dae3a35237e42f6acfe1207a8e7e7bdf5";
          hash = "sha256-NAMa78KhAuoJfp0Cb0Codz84sRfRQ1JhSLNYRI4GBPM=";
        };
        patches = [ ];
        postPatch = null;

        # possibly a real issue, but that version is not supported anymore
        doCheck = false;
      });
    };
  };
in

python.pkgs.buildPythonApplication rec {
  pname = "archivebox";
  version = "0.7.2";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-hdBUEX2tOWN2b11w6aG3x7MP7KQTj4Rwc2w8XvABGf4=";
  };

  build-system = with python.pkgs; [
    pdm-backend
  ];

  dependencies = with python.pkgs; [
    croniter
    dateparser
    django
    django-extensions
    ipython
    mypy-extensions
    python-crontab
    requests
    w3lib
    yt-dlp
  ];

  makeWrapperArgs = [
    "--set USE_NODE True" # used through dependencies, not needed explicitly
    "--set READABILITY_BINARY ${lib.meta.getExe readability-extractor}"
    "--set MERCURY_BINARY ${lib.meta.getExe postlight-parser}"
    "--set CURL_BINARY ${lib.meta.getExe curl}"
    "--set RIPGREP_BINARY ${lib.meta.getExe ripgrep}"
    "--set WGET_BINARY ${lib.meta.getExe wget}"
    "--set GIT_BINARY ${lib.meta.getExe git}"
    "--set YOUTUBEDL_BINARY ${lib.meta.getExe python.pkgs.yt-dlp}"
    "--set SINGLEFILE_BINARY ${lib.meta.getExe single-file-cli}"
  ]
  ++ (
    if (lib.meta.availableOn stdenv.hostPlatform chromium) then
      [
        "--set CHROME_BINARY ${chromium}/bin/chromium-browser"
      ]
    else
      [
        "--set-default USE_CHROME False"
      ]
  );

  meta = with lib; {
    description = "Open source self-hosted web archiving";
    homepage = "https://archivebox.io";
    license = licenses.mit;
    maintainers = with maintainers; [
      siraben
      viraptor
    ];
    platforms = platforms.unix;
  };
}
+0 −163
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitLab,
  makeWrapper,
  python3,
  antlr4_9,
}:

let

  python = python3.override {
    self = python;
    packageOverrides = self: super: {
      antlr4-python3-runtime = super.antlr4-python3-runtime.override {
        antlr4 = antlr4_9;
      };

      baserow_premium = self.buildPythonPackage rec {
        pname = "baserow_premium";
        version = "1.12.1";
        format = "setuptools";

        src = fetchFromGitLab {
          owner = "bramw";
          repo = "baserow_premium";
          rev = "refs/tags/${version}";
          hash = "sha256-zT2afl3QNE2dO3JXjsZXqSmm1lv3EorG3mYZLQQMQ2Q=";
        };

        sourceRoot = "${src.name}/premium/backend";

        doCheck = false;
      };

      django = super.django_3;
    };
  };
in

with python.pkgs;
buildPythonApplication rec {
  pname = "baserow";
  version = "1.12.1";
  format = "setuptools";

  src = fetchFromGitLab {
    owner = "bramw";
    repo = "baserow";
    rev = "refs/tags/${version}";
    hash = "sha256-zT2afl3QNE2dO3JXjsZXqSmm1lv3EorG3mYZLQQMQ2Q=";
  };

  sourceRoot = "${src.name}/backend";

  postPatch = ''
    # use input files to not depend on outdated peer dependencies
    mv requirements/base.{in,txt}
    mv requirements/dev.{in,txt}

    # remove dependency constraints
    sed -i requirements/base.txt \
      -e 's/[~<>=].*//' -i requirements/base.txt \
      -e 's/zope-interface/zope.interface/' \
      -e 's/\[standard\]//'
  '';

  nativeBuildInputs = [
    makeWrapper
  ];

  propagatedBuildInputs = [
    autobahn
    advocate
    antlr4-python3-runtime
    boto3
    cached-property
    celery-redbeat
    channels
    channels-redis
    daphne
    dj-database-url
    django-celery-beat
    django-celery-email
    django-cors-headers
    django-health-check
    django-redis
    django-storages
    drf-jwt
    drf-spectacular
    faker
    gunicorn
    importlib-resources
    itsdangerous
    pillow
    pyparsing
    psutil
    psycopg2
    redis
    regex
    requests
    service-identity
    setuptools
    tqdm
    twisted
    unicodecsv
    uvicorn
    watchgod
    zipp
  ]
  ++ uvicorn.optional-dependencies.standard;

  postInstall = ''
    wrapProgram $out/bin/baserow \
      --prefix PYTHONPATH : "$PYTHONPATH" \
      --prefix DJANGO_SETTINGS_MODULE : "baserow.config.settings.base"
  '';

  nativeCheckInputs = [
    baserow_premium
    boto3
    freezegun
    httpretty
    openapi-spec-validator
    pyinstrument
    pytestCheckHook
    pytest-django
    pytest-unordered
    responses
    zope-interface
  ];

  fixupPhase = ''
    cp -r src/baserow/contrib/database/{api,action,trash,formula,file_import} \
      $out/${python.sitePackages}/baserow/contrib/database/
    cp -r src/baserow/core/management/backup $out/${python.sitePackages}/baserow/core/management/
  '';

  disabledTests = [
    # Disable linting checks
    "flake8_plugins"
  ];

  disabledTestPaths = [
    # Disable premium tests
    "../premium/backend/src/baserow_premium"
    "../premium/backend/tests/baserow_premium"
    # Disable database related tests
    "tests/baserow/contrib/database"
    "tests/baserow/api"
    "tests/baserow/core"
    "tests/baserow/ws"
  ];

  DJANGO_SETTINGS_MODULE = "baserow.config.settings.test";

  meta = with lib; {
    description = "No-code database and Airtable alternative";
    homepage = "https://baserow.io";
    license = licenses.mit;
    maintainers = with maintainers; [ onny ];
    mainProgram = "baserow";
  };
}
+0 −63
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchPypi,
  replaceVars,
  geos_3_9,
  gdal,
  asgiref,
  pytz,
  sqlparse,
  tzdata,
  pythonOlder,
  withGdal ? false,
}:

buildPythonPackage rec {
  pname = "django";
  version = "3.2.25";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    pname = "Django";
    inherit version;
    hash = "sha256-fKOKeGVK7nI3hZTWPlFjbAS44oV09VBd/2MIlbVHJ3c=";
  };

  patches = [
    (replaceVars ./django_3_set_zoneinfo_dir.patch {
      zoneinfo = tzdata + "/share/zoneinfo";
    })
  ]
  ++ lib.optional withGdal (
    replaceVars ./django_3_set_geos_gdal_lib.patch {
      inherit geos_3_9;
      inherit gdal;
      extension = stdenv.hostPlatform.extensions.sharedLibrary;
    }
  );

  propagatedBuildInputs = [
    asgiref
    pytz
    sqlparse
  ];

  # too complicated to setup
  doCheck = false;

  pythonImportsCheck = [ "django" ];

  meta = with lib; {
    description = "High-level Python Web framework";
    homepage = "https://www.djangoproject.com/";
    license = licenses.bsd3;
    maintainers = with maintainers; [ georgewhewell ];
    knownVulnerabilities = [
      "Support for Django 3.2 ended on 2024-04-01, see https://www.djangoproject.com/download/#supported-versions."
    ];
  };
}
+0 −24
Original line number Diff line number Diff line
diff -Nur a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.py
--- a/django/contrib/gis/gdal/libgdal.py	2020-07-09 22:34:05.330568948 +0100
+++ b/django/contrib/gis/gdal/libgdal.py	2020-07-09 22:35:08.679095615 +0100
@@ -14,7 +14,7 @@
     from django.conf import settings
     lib_path = settings.GDAL_LIBRARY_PATH
 except (AttributeError, ImportError, ImproperlyConfigured, OSError):
-    lib_path = None
+    lib_path = "@gdal@/lib/libgdal@extension@"

 if lib_path:
     lib_names = None
diff -Nur a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py
--- a/django/contrib/gis/geos/libgeos.py	2020-07-09 22:34:05.331568941 +0100
+++ b/django/contrib/gis/geos/libgeos.py	2020-07-09 22:36:24.863526276 +0100
@@ -24,7 +24,7 @@
         from django.conf import settings
         lib_path = settings.GEOS_LIBRARY_PATH
     except (AttributeError, ImportError, ImproperlyConfigured, OSError):
-        lib_path = None
+        lib_path = "@geos_3_9@/lib/libgeos_c@extension@"

     # Setting the appropriate names for the GEOS-C library.
     if lib_path:
+0 −13
Original line number Diff line number Diff line
diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index 28302440c7..278cfa5e62 100644
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -200,7 +200,7 @@ class Settings:
         if hasattr(time, 'tzset') and self.TIME_ZONE:
             # When we can, attempt to validate the timezone. If we can't find
             # this file, no check happens and it's harmless.
-            zoneinfo_root = Path('/usr/share/zoneinfo')
+            zoneinfo_root = Path('@zoneinfo@')
             zone_info_file = zoneinfo_root.joinpath(*self.TIME_ZONE.split('/'))
             if zoneinfo_root.exists() and not zone_info_file.exists():
                 raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
Loading