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

Merge pull request #232255 from mweinelt/django-hijack

python310Packages.django-hijack: 3.2.6 -> 3.3.0, build from source, rename from django_hijack
parents 85766e1c 31aa936b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
{ lib, buildPythonPackage, fetchFromGitHub, python,
  django_hijack, django_nose }:
  django-hijack, django_nose }:
buildPythonPackage rec {
  pname = "django-hijack-admin";
  version = "2.1.10";
@@ -13,7 +13,7 @@ buildPythonPackage rec {
  };

  nativeCheckInputs = [ django_nose ];
  propagatedBuildInputs = [ django_hijack ];
  propagatedBuildInputs = [ django-hijack ];

  checkPhase = ''
    runHook preCheck
+45 −18
Original line number Diff line number Diff line
{ lib
, fetchPypi
, fetchFromGitHub
, fetchNpmDeps
, buildPythonPackage

# build-system
, gettext
, nodejs
, npmHooks
, setuptools-scm

# dependencies
, django
, django_compat

# tests
, pytest-django
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "django-hijack";
  version = "3.2.6";

  # the wheel comes with pre-built assets, allowing us to avoid fighting
  # with npm/webpack/gettext to build them ourselves.
  format = "wheel";

  src = fetchPypi {
    inherit version format;
    pname = "django_hijack";
    dist = "py3";
    python = "py3";
    hash = "sha256-xFPZ03II1814+bZ5gx7GD/AxYMiLuH6awfSeXEraOHQ=";
  version = "3.3.0";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "django-hijack";
    repo = "django-hijack";
    rev = "refs/tags/${version}";
    hash = "sha256-ytQ4xxkBAC3amQbenD8RO5asrbfNAjOspWUY3c2hkig=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace 'cmd = ["npm", "ci"]' 'cmd = ["true"]' \
      --replace 'f"{self.build_lib}/{name}.mo"' 'f"{name}.mo"'

    sed -i "/addopts/d" setup.cfg
  '';

  npmDeps = fetchNpmDeps {
    inherit src;
    hash = "sha256-FLfMCn2jsLlTTsC+LRMX0dmVCCbNAr2pQUsSQRKgo6E=";
  };

  SETUPTOOLS_SCM_PRETEND_VERSION = version;

  nativeBuildInputs = [
    gettext
    nodejs
    npmHooks.npmConfigHook
    setuptools-scm
  ];

  propagatedBuildInputs = [
    django
    django_compat
@@ -33,13 +62,11 @@ buildPythonPackage rec {
    pytest-django
  ];

  preCheck = ''
    export DJANGO_SETTINGS_MODULE='hijack.tests.test_app.settings'
  '';
  env.DJANGO_SETTINGS_MODULE = "hijack.tests.test_app.settings";

  pytestFlagsArray = [
    "--pyargs"
    "hijack"
    "--pyargs" "hijack"
    "-W" "ignore::DeprecationWarning"
  ];

  meta = with lib; {
+2 −0
Original line number Diff line number Diff line
@@ -86,6 +86,8 @@ mapAliases ({
  django_environ = django-environ; # added 2021-12-25
  django_extensions = django-extensions; # added 2022-01-09
  django_guardian = django-guardian; # added 2022-05-19
  django_hijack = django-hijack; # added 2023-05-16
  django_hijack_admin = django-hijack-admin; # added 2023-05-16
  django_modelcluster = django-modelcluster; # added 2022-04-02
  django_reversion = django-reversion; # added 2022-06-18
  django_polymorphic = django-polymorphic; # added 2022-05-24
+2 −3
Original line number Diff line number Diff line
@@ -2693,10 +2693,9 @@ self: super: with self; {

  django-hierarkey = callPackage ../development/python-modules/django-hierarkey { };

  django_hijack_admin = callPackage ../development/python-modules/django-hijack-admin { };
  django-hijack-admin = callPackage ../development/python-modules/django-hijack-admin { };

  django_hijack = callPackage ../development/python-modules/django-hijack { };
  # This package may need an older version of Django. Override the package set and set e.g. `django = super.django_1_9`. See the Nixpkgs manual for examples on how to override the package set.
  django-hijack = callPackage ../development/python-modules/django-hijack { };

  django-i18nfield = callPackage ../development/python-modules/django-i18nfield { };