Stuart Henderson wrote (2024-12-28 18:00 CET):
> On 2024/12/28 17:47, Stefan Hagen wrote:
> > Hi,
> >
> > The readfp() method of pythons ConfigParser Class has been deprecated
> > in Python 3.2 and got removed in Python 3.12. The replacing method is
> > read_file().
> >
> > I'm not going to bother upstream. They dropped the ball after reddit
> > changed their API terms (last commit 4 years ago).
>
> ok
>
> > However, tuir still works perfectly fine when you create your own "app"
> > on reddit and configure tuir to use the app secret / token.
>
> is that worth a mention e.g. in DESCR?
>
AFAIR it's not really documented outside of the issues section on
gitlab. How about this?
Index: www/tuir/Makefile
===================================================================
RCS file: /cvs/ports/www/tuir/Makefile,v
diff -u -p -r1.12 Makefile
--- www/tuir/Makefile 21 Dec 2024 11:39:15 -0000 1.12
+++ www/tuir/Makefile 28 Dec 2024 17:41:25 -0000
@@ -3,7 +3,7 @@ COMMENT = terminal UI for Reddit
MODPY_DISTV = 1.29.0
DISTNAME = tuir-${MODPY_DISTV}
-REVISION = 7
+REVISION = 8
CATEGORIES = www
Index: www/tuir/patches/patch-tuir_config_py
===================================================================
RCS file: www/tuir/patches/patch-tuir_config_py
diff -N www/tuir/patches/patch-tuir_config_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ www/tuir/patches/patch-tuir_config_py 28 Dec 2024 17:41:25 -0000
@@ -0,0 +1,12 @@
+Index: tuir/config.py
+--- tuir/config.py.orig
++++ tuir/config.py
+@@ -131,7 +131,7 @@ class Config(object):
+ config = configparser.RawConfigParser()
+ if os.path.exists(filename):
+ with codecs.open(filename, encoding='utf-8') as fp:
+- config.readfp(fp)
++ config.read_file(fp)
+
+ return cls._parse_tuir_file(config)
+
Index: www/tuir/patches/patch-tuir_theme_py
===================================================================
RCS file: www/tuir/patches/patch-tuir_theme_py
diff -N www/tuir/patches/patch-tuir_theme_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ www/tuir/patches/patch-tuir_theme_py 28 Dec 2024 17:41:25 -0000
@@ -0,0 +1,12 @@
+Index: tuir/theme.py
+--- tuir/theme.py.orig
++++ tuir/theme.py
+@@ -399,7 +399,7 @@ class Theme(object):
+ config = configparser.ConfigParser()
+ config.optionxform = six.text_type # Preserve case
+ with codecs.open(filename, encoding='utf-8') as fp:
+- config.readfp(fp)
++ config.read_file(fp)
+ except configparser.ParsingError as e:
+ raise ConfigError(e.message)
+
Index: www/tuir/pkg/PLIST
===================================================================
RCS file: /cvs/ports/www/tuir/pkg/PLIST,v
diff -u -p -r1.4 PLIST
--- www/tuir/pkg/PLIST 21 Dec 2024 11:46:05 -0000 1.4
+++ www/tuir/pkg/PLIST 28 Dec 2024 17:41:25 -0000
@@ -113,3 +113,4 @@ lib/python${MODPY_VERSION}/site-packages
lib/python${MODPY_VERSION}/site-packages/tuir/themes/solarized-dark.cfg
lib/python${MODPY_VERSION}/site-packages/tuir/themes/solarized-light.cfg
@man man/man1/tuir.1
+share/doc/pkg-readmes/${PKGSTEM}
Index: www/tuir/pkg/README
===================================================================
RCS file: www/tuir/pkg/README
diff -N www/tuir/pkg/README
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ www/tuir/pkg/README 28 Dec 2024 17:41:25 -0000
@@ -0,0 +1,32 @@
++-----------------------------------------------------------------------
+| Running ${PKGSTEM} on OpenBSD
++-----------------------------------------------------------------------
+
+Since Reddit has changed their API terms, tuir does not work out of the
+box anymore. The following steps are required to make tuir work:
+
+1. Log on to reddit.com and open https://www.reddit.com/prefs/apps
+2. Click on "create application" and fill out the form:
+ - name: can be anything, for example "tuir"
+ - ( ) web app
+ ( ) installed app
+ (x) script
+ - description: anything or leave empty
+ - about url: leave empty
+ - redirect uri: http://127.0.0.1:65000/
+3. Complete the Captcha and click "create app"
+4. Note down the "secret"
+5. Note down the "client id", which is the string displayed above the
+ secret, directly under "presonal use script".
+
+Once the "app" is created, tuir can be configured to use it.
+
+1. run the command: tuir --copy-config
+2. Open ~/.config/tuir/tuir.cfg in an editor and replace the values in
+ the following entries with the ones optained above:
+
+ oauth_client_id = <reddit app client id>
+ oauth_client_secret = <reddit app secret>
+ oauth_redirect_uri = http://127.0.0.1:65000/
+
+tuir should now work.
No comments:
Post a Comment