pgadmin4: expose setup.py as pgadmin4-setup
This commit is contained in:
parent
7b6d25b6dc
commit
3cbd5a6deb
2 changed files with 70 additions and 0 deletions
|
@ -35,6 +35,11 @@ python3.pkgs.buildPythonApplication rec {
|
|||
|
||||
format = "setuptools";
|
||||
|
||||
patches = [
|
||||
# Expose setup.py for later use
|
||||
./expose-setup.py.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# patching Makefile, so it doesn't try to build sphinx documentation here
|
||||
# (will do so later)
|
||||
|
|
65
pkgs/tools/admin/pgadmin/expose-setup.py.patch
Normal file
65
pkgs/tools/admin/pgadmin/expose-setup.py.patch
Normal file
|
@ -0,0 +1,65 @@
|
|||
From 391433d020da52fba28ad08beb2cc85ffd852044 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= <mkg20001@gmail.com>
|
||||
Date: Wed, 23 Feb 2022 14:40:11 +0100
|
||||
Subject: [PATCH] Expose setup.py as pgadmin4-setup
|
||||
|
||||
---
|
||||
pkg/pip/setup_pip.py | 5 ++++-
|
||||
web/setup.py | 14 ++++++++------
|
||||
2 files changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/pkg/pip/setup_pip.py b/pkg/pip/setup_pip.py
|
||||
index 5592d1b04..131eaa1ed 100644
|
||||
--- a/pkg/pip/setup_pip.py
|
||||
+++ b/pkg/pip/setup_pip.py
|
||||
@@ -95,7 +95,10 @@ setup(
|
||||
},
|
||||
|
||||
entry_points={
|
||||
- 'console_scripts': ['pgadmin4=pgadmin4.pgAdmin4:main'],
|
||||
+ 'console_scripts': [
|
||||
+ 'pgadmin4=pgadmin4.pgAdmin4:main',
|
||||
+ 'pgadmin4-setup=pgadmin4.setup:main'
|
||||
+ ],
|
||||
},
|
||||
|
||||
)
|
||||
diff --git a/web/setup.py b/web/setup.py
|
||||
index 5f4257e86..df970f049 100644
|
||||
--- a/web/setup.py
|
||||
+++ b/web/setup.py
|
||||
@@ -32,6 +32,10 @@ from pgadmin import create_app
|
||||
from pgadmin.utils import clear_database_servers, dump_database_servers,\
|
||||
load_database_servers
|
||||
|
||||
+# Configuration settings
|
||||
+import config
|
||||
+from pgadmin.model import SCHEMA_VERSION
|
||||
+from pgadmin.setup import db_upgrade, create_app_data_directory
|
||||
|
||||
def dump_servers(args):
|
||||
"""Dump the server groups and servers.
|
||||
@@ -139,12 +143,7 @@ def clear_servers():
|
||||
clear_database_servers(load_user, True)
|
||||
|
||||
|
||||
-if __name__ == '__main__':
|
||||
- # Configuration settings
|
||||
- import config
|
||||
- from pgadmin.model import SCHEMA_VERSION
|
||||
- from pgadmin.setup import db_upgrade, create_app_data_directory
|
||||
-
|
||||
+def main():
|
||||
parser = argparse.ArgumentParser(description='Setup the pgAdmin config DB')
|
||||
|
||||
exp_group = parser.add_argument_group('Dump server config')
|
||||
@@ -194,3 +193,6 @@ if __name__ == '__main__':
|
||||
print(str(e))
|
||||
else:
|
||||
setup_db()
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ main()
|
||||
--
|
||||
2.35.1
|
||||
|
Loading…
Reference in a new issue