|
| 1 | +{ |
| 2 | + lib, |
| 3 | + python3, |
| 4 | + fetchFromGitHub, |
| 5 | + gdal, |
| 6 | + geos, |
| 7 | + pnpm, |
| 8 | + nodejs, |
| 9 | + postgresql, |
| 10 | + postgresqlTestHook, |
| 11 | + playwright-driver, |
| 12 | +}: |
| 13 | +let |
| 14 | + |
| 15 | + python = python3.override { |
| 16 | + packageOverrides = self: super: { |
| 17 | + django = super.django.override { withGdal = true; }; |
| 18 | + |
| 19 | + # Project discontinued upstream |
| 20 | + # https://github.com/okfde/froide/issues/893 |
| 21 | + django-fsm = self.buildPythonPackage rec { |
| 22 | + pname = "django-fsm"; |
| 23 | + version = "3.0.0"; |
| 24 | + pyproject = true; |
| 25 | + |
| 26 | + src = fetchFromGitHub { |
| 27 | + owner = "viewflow"; |
| 28 | + repo = "django-fsm"; |
| 29 | + rev = "refs/tags/${version}"; |
| 30 | + hash = "sha256-woN0F4hTaPk8HTGNT6zQlZDJ9SCVRut9maKSlDmalUE="; |
| 31 | + }; |
| 32 | + |
| 33 | + build-system = [ self.setuptools ]; |
| 34 | + |
| 35 | + dependencies = [ self.django ]; |
| 36 | + |
| 37 | + checkInputs = [ self.django-guardian ]; |
| 38 | + |
| 39 | + checkPhase = '' |
| 40 | + ${python3.interpreter} tests/manage.py test |
| 41 | + ''; |
| 42 | + |
| 43 | + pythonImportsCheck = [ "django_fsm" ]; |
| 44 | + |
| 45 | + meta = { |
| 46 | + description = "Django friendly finite state machine support"; |
| 47 | + homepage = "https://github.com/viewflow/django-fsm"; |
| 48 | + license = lib.licenses.mit; |
| 49 | + knownVulnerabilities = [ "Package is marked as discontinued upstream." ]; |
| 50 | + maintainers = [ lib.maintainers.onny ]; |
| 51 | + }; |
| 52 | + }; |
| 53 | + }; |
| 54 | + }; |
| 55 | + |
| 56 | +in |
| 57 | +python.pkgs.buildPythonPackage rec { |
| 58 | + pname = "froide"; |
| 59 | + version = "0-unstable-2024-11-22"; |
| 60 | + pyproject = true; |
| 61 | + |
| 62 | + src = fetchFromGitHub { |
| 63 | + owner = "okfde"; |
| 64 | + repo = "froide"; |
| 65 | + rev = "a90f5c4d40b46a161111eefdc84e5214e85715b0"; |
| 66 | + hash = "sha256-Q+iNI3yqxqAtDONHY+SaZeMyjY6hqTxwy7YmiiY94+0="; |
| 67 | + }; |
| 68 | + |
| 69 | + patches = [ ./django_42_storages.patch ]; |
| 70 | + |
| 71 | + pythonRelaxDeps = [ |
| 72 | + "pikepdf" |
| 73 | + "channels" |
| 74 | + ]; |
| 75 | + |
| 76 | + build-system = [ python.pkgs.setuptools ]; |
| 77 | + |
| 78 | + nativeBuildInputs = [ |
| 79 | + pnpm.configHook |
| 80 | + nodejs |
| 81 | + ]; |
| 82 | + |
| 83 | + dependencies = with python.pkgs; [ |
| 84 | + bleach |
| 85 | + celery |
| 86 | + celery-singleton |
| 87 | + channels |
| 88 | + coreapi |
| 89 | + dj-database-url |
| 90 | + django |
| 91 | + django-celery-beat |
| 92 | + django-celery-email |
| 93 | + django-configurations |
| 94 | + django-contrib-comments |
| 95 | + django-crossdomainmedia |
| 96 | + django-elasticsearch-dsl |
| 97 | + django-filingcabinet |
| 98 | + django-filter |
| 99 | + django-fsm |
| 100 | + django-json-widget |
| 101 | + django-leaflet |
| 102 | + django-mfa3 |
| 103 | + django-oauth-toolkit |
| 104 | + django-parler |
| 105 | + django-storages |
| 106 | + django-taggit |
| 107 | + django-treebeard |
| 108 | + djangorestframework |
| 109 | + djangorestframework-csv |
| 110 | + djangorestframework-jsonp |
| 111 | + drf-spectacular |
| 112 | + drf-spectacular-sidecar |
| 113 | + easy-thumbnails |
| 114 | + elasticsearch |
| 115 | + elasticsearch-dsl |
| 116 | + geoip2 |
| 117 | + icalendar |
| 118 | + markdown |
| 119 | + phonenumbers |
| 120 | + pillow |
| 121 | + pikepdf |
| 122 | + psycopg |
| 123 | + pygtail |
| 124 | + pyisemail |
| 125 | + pypdf |
| 126 | + python-magic |
| 127 | + python-mimeparse |
| 128 | + python-slugify |
| 129 | + requests |
| 130 | + wand |
| 131 | + weasyprint |
| 132 | + websockets |
| 133 | + ]; |
| 134 | + |
| 135 | + pnpmDeps = pnpm.fetchDeps { |
| 136 | + inherit pname version src; |
| 137 | + hash = "sha256-DMoaXNm5S64XBERHFnFM6IKBkzXRGDEYWSTruccK9Hc="; |
| 138 | + }; |
| 139 | + |
| 140 | + postBuild = '' |
| 141 | + pnpm run build |
| 142 | + ''; |
| 143 | + |
| 144 | + postInstall = '' |
| 145 | + cp -r build $out/${python.sitePackages}/froide/ |
| 146 | + ''; |
| 147 | + |
| 148 | + nativeCheckInputs = with python.pkgs; [ |
| 149 | + (postgresql.withPackages (p: [ p.postgis ])) |
| 150 | + postgresqlTestHook |
| 151 | + pytest-django |
| 152 | + pytest-playwright |
| 153 | + pytestCheckHook |
| 154 | + ]; |
| 155 | + |
| 156 | + checkInputs = with python.pkgs; [ |
| 157 | + beautifulsoup4 |
| 158 | + pytest-factoryboy |
| 159 | + time-machine |
| 160 | + ]; |
| 161 | + |
| 162 | + disabledTests = [ |
| 163 | + # Requires network connection: elastic_transport.ConnectionError |
| 164 | + "test_search_similar" |
| 165 | + "test_search" |
| 166 | + "test_list_requests" |
| 167 | + "test_list_jurisdiction_requests" |
| 168 | + "test_tagged_requests" |
| 169 | + "test_publicbody_requests" |
| 170 | + "test_feed" |
| 171 | + "test_request_list_filter_pagination" |
| 172 | + "test_request_list_path_filter" |
| 173 | + "test_web_page" |
| 174 | + "test_autocomplete" |
| 175 | + "test_list_no_identical" |
| 176 | + "test_set_status" |
| 177 | + "test_make_not_logged_in_request" |
| 178 | + "test_make_logged_in_request" |
| 179 | + # TypeError: Pygtail.with_offsets() got an unexpected keyword argument |
| 180 | + "test_email_signal" |
| 181 | + "test_pygtail_log_append" |
| 182 | + "test_bouncing_email" |
| 183 | + "test_multiple_partial" |
| 184 | + "test_logfile_rotation" |
| 185 | + ]; |
| 186 | + |
| 187 | + preCheck = '' |
| 188 | + export PGUSER="froide" |
| 189 | + export postgresqlEnableTCP=1 |
| 190 | + export postgresqlTestUserOptions="LOGIN SUPERUSER" |
| 191 | + export GDAL_LIBRARY_PATH="${gdal}/lib/libgdal.so" |
| 192 | + export GEOS_LIBRARY_PATH="${geos}/lib/libgeos_c.so" |
| 193 | + export PLAYWRIGHT_BROWSERS_PATH="${playwright-driver.browsers}" |
| 194 | + ''; |
| 195 | + |
| 196 | + meta = { |
| 197 | + description = "Freedom of Information Portal"; |
| 198 | + homepage = "https://github.com/okfde/froide"; |
| 199 | + license = lib.licenses.mit; |
| 200 | + maintainers = [ lib.maintainers.onny ]; |
| 201 | + mainProgram = "froide"; |
| 202 | + }; |
| 203 | +} |
0 commit comments