git: 55b68f21474e - main - net/py-anonfile: New port: Unofficial library that wraps the anonfile.com REST API

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Wed, 05 Jul 2023 17:25:31 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=55b68f21474e20e69bae407af0d10be8746a103a

commit 55b68f21474e20e69bae407af0d10be8746a103a
Author:     Jesús Daniel Colmenares Oviedo <DtxdF@disroot.org>
AuthorDate: 2023-06-30 21:41:46 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-07-05 17:21:09 +0000

    net/py-anonfile: New port: Unofficial library that wraps the anonfile.com REST API
    
    anonfile is an unofficial Python API created to make uploading and
    downloading files from <anonfiles.com> simple and effective for
    programming in Python. The goal of the project is to create an
    intuitive library for anonymous file sharing.
    
    WWW: https://github.com/nstrydom2/anonfile-api
    
    PR:             272021
---
 net/Makefile                                       |  1 +
 net/py-anonfile/Makefile                           | 23 +++++++++++++++
 net/py-anonfile/distinfo                           |  3 ++
 net/py-anonfile/files/patch-setup.py               | 33 ++++++++++++++++++++++
 .../files/patch-src_anonfile_anonfile.py           | 12 ++++++++
 net/py-anonfile/pkg-descr                          |  4 +++
 6 files changed, 76 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index e8c543b9a1da..3c190239cb5a 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1038,6 +1038,7 @@
     SUBDIR += py-aiohttp-socks
     SUBDIR += py-amqp
     SUBDIR += py-amqplib
+    SUBDIR += py-anonfile
     SUBDIR += py-avahi
     SUBDIR += py-bonsai
     SUBDIR += py-cepa
diff --git a/net/py-anonfile/Makefile b/net/py-anonfile/Makefile
new file mode 100644
index 000000000000..bfbb6655b116
--- /dev/null
+++ b/net/py-anonfile/Makefile
@@ -0,0 +1,23 @@
+PORTNAME=	anonfile
+DISTVERSION=	0.2.7
+CATEGORIES=	net python
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	DtxdF@disroot.org
+COMMENT=	Unofficial library that wraps the anonfile.com REST API
+WWW=		https://github.com/nstrydom2/anonfile-api
+
+LICENSE=	MIT
+
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}importlib-metadata>0:devel/py-importlib-metadata@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}requests-toolbelt>0:www/py-requests-toolbelt@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tqdm>0:misc/py-tqdm@${PY_FLAVOR}
+
+USES=		python:3.9+
+USE_PYTHON=	autoplist distutils
+
+NO_ARCH=	yes
+
+.include <bsd.port.mk>
diff --git a/net/py-anonfile/distinfo b/net/py-anonfile/distinfo
new file mode 100644
index 000000000000..0126184fde4d
--- /dev/null
+++ b/net/py-anonfile/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1686877067
+SHA256 (anonfile-0.2.7.tar.gz) = 25357970d0e567208f4b07f6ebf036c4934b78f04f991b271bf89fe13252359d
+SIZE (anonfile-0.2.7.tar.gz) = 12086
diff --git a/net/py-anonfile/files/patch-setup.py b/net/py-anonfile/files/patch-setup.py
new file mode 100644
index 000000000000..91358e0d20c5
--- /dev/null
+++ b/net/py-anonfile/files/patch-setup.py
@@ -0,0 +1,33 @@
+--- setup.py.orig	2023-06-16 04:37:29 UTC
++++ setup.py
+@@ -9,14 +9,6 @@ with open("src/anonfile/anonfile.py", encoding='utf-8'
+     python_major = int(re.search(r'python_major = "(.*?)"', lines).group(1))
+     python_minor = int(re.search(r'python_minor = "(.*?)"', lines).group(1))
+ 
+-print("reading dependency file")
+-
+-with open("requirements/release.txt", mode='r', encoding='utf-8') as requirements:
+-    packages = requirements.read().splitlines()
+-
+-with open("requirements/dev.txt", mode='r', encoding='utf-8') as requirements:
+-    dev_packages = requirements.read().splitlines()
+-
+ print("reading readme file")
+ 
+ with open("README.md", "r") as fh:
+@@ -37,9 +29,13 @@ setup(
+         'Changelog': "https://github.com/nstrydom2/anonfile-api/blob/master/CHANGELOG.md"
+     },    
+     python_requires=">=%d.%d" % (python_major, python_minor),
+-    install_requires=packages,
++    install_requires=[
++        "requests",
++        "requests-toolbelt",
++        "tqdm",
++        "importlib-metadata"
++    ],
+     extra_requires={
+-        'dev': dev_packages[1:],
+         'test': ['pytest']
+     },
+     package_dir={'': 'src'},
diff --git a/net/py-anonfile/files/patch-src_anonfile_anonfile.py b/net/py-anonfile/files/patch-src_anonfile_anonfile.py
new file mode 100644
index 000000000000..235d7c3aa0ff
--- /dev/null
+++ b/net/py-anonfile/files/patch-src_anonfile_anonfile.py
@@ -0,0 +1,12 @@
+--- src/anonfile/anonfile.py.orig	2023-06-16 05:34:29 UTC
++++ src/anonfile/anonfile.py
+@@ -65,7 +65,8 @@ def get_config_dir() -> Path:
+     return {
+         'Windows': Path(os.path.expandvars('%LOCALAPPDATA%')),
+         'Darwin': Path.home().joinpath('Library').joinpath('Application Support'),
+-        'Linux': Path.home().joinpath('.config')
++        'Linux': Path.home().joinpath('.config'),
++        'FreeBSD': Path.home().joinpath('.config')
+     }[platform.system()].joinpath(package_name)
+ 
+ def get_logfile_path() -> Path:
diff --git a/net/py-anonfile/pkg-descr b/net/py-anonfile/pkg-descr
new file mode 100644
index 000000000000..572f14dd7ef5
--- /dev/null
+++ b/net/py-anonfile/pkg-descr
@@ -0,0 +1,4 @@
+anonfile is an unofficial Python API created to make uploading and
+downloading files from <anonfiles.com> simple and effective for
+programming in Python. The goal of the project is to create an
+intuitive library for anonymous file sharing.