Module: tools
Branch: master
Commit: 96295d51e76b97cdf9d9e6ddbf9a78fd202f0bcd
URL: https://source.winehq.org/git/tools.git/?a=commit;h=96295d51e76b97cdf9d9e6d…
Author: Jeremy White <jwhite(a)codeweavers.com>
Date: Wed Apr 27 09:11:07 2022 -0500
Add a todo for db.py cleanup.
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
gitlab/gitlab-to-mail/README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/gitlab/gitlab-to-mail/README.md b/gitlab/gitlab-to-mail/README.md
index 9f3f15b..b1d966a 100644
--- a/gitlab/gitlab-to-mail/README.md
+++ b/gitlab/gitlab-to-mail/README.md
@@ -17,5 +17,6 @@
* Run getmail in a loop similar to the one above / as a cron job.
## TODOs:
+ * Make db.py into a class that allows it to be passed the database path
* Maybe have replies from the mailing list be 'unresolved'?
* Super difficult: have responses from the mailing list generate the diff line_range junk
Module: tools
Branch: master
Commit: 9f5f8f5dc3044b855adc54e05169dcc545bf8840
URL: https://source.winehq.org/git/tools.git/?a=commit;h=9f5f8f5dc3044b855adc54e…
Author: Jeremy White <jwhite(a)codeweavers.com>
Date: Tue Apr 26 15:24:36 2022 -0500
Remove the CUSTOM_HEADERS option.
We're not using it, and it is not worth getting
configParser to support it.
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
gitlab/gitlab-to-mail/example.cfg | 3 ---
gitlab/gitlab-to-mail/gitlabtomail.py | 3 ---
2 files changed, 6 deletions(-)
diff --git a/gitlab/gitlab-to-mail/example.cfg b/gitlab/gitlab-to-mail/example.cfg
index 3cd31d9..19e877c 100644
--- a/gitlab/gitlab-to-mail/example.cfg
+++ b/gitlab/gitlab-to-mail/example.cfg
@@ -27,9 +27,6 @@ SMTP_PORT = 587
#SMTP_USER = "login"
#SMTP_PASSWORD = "pass"
-# can be used for mailman's 'Approved' header
-CUSTOM_HEADERS = { }
-
# When run for the first time, how far back in time should we look for
# merge requests and related events
INITIAL_BACKLOG_DAYS = 5
diff --git a/gitlab/gitlab-to-mail/gitlabtomail.py b/gitlab/gitlab-to-mail/gitlabtomail.py
index 0a5ef4b..2dfc72a 100755
--- a/gitlab/gitlab-to-mail/gitlabtomail.py
+++ b/gitlab/gitlab-to-mail/gitlabtomail.py
@@ -45,9 +45,6 @@ def send_email(message):
message['Reply-To'] = settings.BRIDGE_FROM_EMAIL
message['To'] = settings.BRIDGE_TO_EMAIL
- for k, v in settings.CUSTOM_HEADERS.items():
- message[k] = v
-
encoded_message = message.as_string().encode('utf-8')
if settings.DEBUG:
Module: tools
Branch: master
Commit: 195e2f6d6f18e63b7bef4f2f9bbf88a21bf0d855
URL: https://source.winehq.org/git/tools.git/?a=commit;h=195e2f6d6f18e63b7bef4f2…
Author: Jeremy White <jwhite(a)codeweavers.com>
Date: Tue Apr 26 13:29:02 2022 -0500
Make the database location configurable.
Rather than being implicity based on argv[1]
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
gitlab/gitlab-to-mail/db.py | 7 ++++++-
gitlab/gitlab-to-mail/settings_example.py | 3 +++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/gitlab/gitlab-to-mail/db.py b/gitlab/gitlab-to-mail/db.py
index 118d3c7..472026c 100644
--- a/gitlab/gitlab-to-mail/db.py
+++ b/gitlab/gitlab-to-mail/db.py
@@ -1,8 +1,13 @@
from sqlalchemy import create_engine, Column, Integer, Unicode, DateTime, Date
from sqlalchemy.orm import declarative_base, sessionmaker
+import importlib
+import os
import sys
+sys.path.append(os.getcwd())
+settings = importlib.import_module(f"settings_{sys.argv[1]}")
+
Base = declarative_base()
@@ -25,7 +30,7 @@ class GlobalState(Base):
integer_value = Column(Integer)
-engine = create_engine(f"sqlite:///db_{sys.argv[1]}.sqlite", echo=False)
+engine = create_engine(f"sqlite:///{settings.DATABASE}", echo=False)
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
session = Session()
diff --git a/gitlab/gitlab-to-mail/settings_example.py b/gitlab/gitlab-to-mail/settings_example.py
index fca80a2..1a42216 100644
--- a/gitlab/gitlab-to-mail/settings_example.py
+++ b/gitlab/gitlab-to-mail/settings_example.py
@@ -1,3 +1,6 @@
+# Location of the sqlite database file, which will be auto created if not found
+DATABASE= "/home/wine/example/db_example.sqlite"
+
# if True mails are dumped to mail_dump mbox file instead of being sent out
DEBUG = False