-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
58 lines (47 loc) · 1.77 KB
/
install.py
File metadata and controls
58 lines (47 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# Copyright (c) 2026 Tom Keffer <tkeffer@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
"""Installer for the WeeWX PostgreSQL database driver"""
from io import StringIO
import configobj
from weecfg.extension import ExtensionInstaller
CONFIG = """
[Databases]
# PostgreSQL database
[[archive_postgresql]]
# The name of the database for WeeWX to use. Alternatively, set to empty string
# to use environment variable PGDATABASE.
database_name = weewx_data
database_type = PostgreSQL
[DatabaseTypes]
# Defaults for PostgreSQL databases
[[PostgreSQL]]
driver = user.postgresql
# The host where the database is located. Alternatively, set to empty string to
# use environment variable PGHOST.
host = localhost
# The user name for logging in to the host. Alternatively, set to empty string to
# use environment variable PGUSER.
user = weewx
# If necessary, use quotes around the password to guard against parsing errors.
# Alternatively, set to empty string to use environment variable PGPASSWORD.
password = weewx
# If True, use DOUBLE PRECISION for REAL columns.
real_as_double = true
"""
postgresql_dict = configobj.ConfigObj(StringIO(CONFIG))
def loader():
return PostgreSQLInstaller()
class PostgreSQLInstaller(ExtensionInstaller):
def __init__(self):
super(PostgreSQLInstaller, self).__init__(
version="1.0",
name='PostgreSQL',
description='WeeWX driver for the PostgreSQL database',
author="Thomas Keffer",
author_email="tkeffer@gmail.com",
config=postgresql_dict,
files=[('bin/user', ['bin/user/postgresql.py'])]
)