ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / ml / mlflow-server / package.nix
blob82ac934dc8887d3c9c34e928baec93d46b148a5c
1 { python3Packages, writers }:
3 let
4   py = python3Packages;
6   gunicornScript = writers.writePython3 "gunicornMlflow" { } ''
7     import re
8     import sys
9     from gunicorn.app.wsgiapp import run
10     if __name__ == '__main__':
11         sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', ''', sys.argv[0])
12         sys.exit(run())
13   '';
15 py.toPythonApplication (
16   py.mlflow.overridePythonAttrs (old: {
18     propagatedBuildInputs = old.dependencies ++ [
19       py.boto3
20       py.mysqlclient
21     ];
23     postPatch =
24       (old.postPatch or "")
25       + ''
26         cat mlflow/utils/process.py
28         substituteInPlace mlflow/utils/process.py --replace-fail \
29           "process = subprocess.Popen(" \
30           "cmd[0]='${gunicornScript}'; process = subprocess.Popen("
31       '';
33     postInstall = ''
34       gpath=$out/bin/gunicornMlflow
35       cp ${gunicornScript} $gpath
36       chmod 555 $gpath
37     '';
38   })