From a2a498f1671b812f8e11bfdda4526212c0e75782 Mon Sep 17 00:00:00 2001 From: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com> Date: Mon, 3 Nov 2025 20:06:25 -0600 Subject: [PATCH] add: txtorcon (#7056) Signed-off-by: Owen-sz --- anda/langs/python/txtorcon/anda.hcl | 6 ++ anda/langs/python/txtorcon/shebangs.patch | 80 +++++++++++++++++++++++ anda/langs/python/txtorcon/txtorcon.spec | 54 +++++++++++++++ anda/langs/python/txtorcon/update.rhai | 1 + 4 files changed, 141 insertions(+) create mode 100644 anda/langs/python/txtorcon/anda.hcl create mode 100644 anda/langs/python/txtorcon/shebangs.patch create mode 100644 anda/langs/python/txtorcon/txtorcon.spec create mode 100644 anda/langs/python/txtorcon/update.rhai diff --git a/anda/langs/python/txtorcon/anda.hcl b/anda/langs/python/txtorcon/anda.hcl new file mode 100644 index 0000000000..9812f24c16 --- /dev/null +++ b/anda/langs/python/txtorcon/anda.hcl @@ -0,0 +1,6 @@ +project pkg { + arches = ["x86_64"] + rpm { + spec = "txtorcon.spec" + } +} diff --git a/anda/langs/python/txtorcon/shebangs.patch b/anda/langs/python/txtorcon/shebangs.patch new file mode 100644 index 0000000000..fed9620aaa --- /dev/null +++ b/anda/langs/python/txtorcon/shebangs.patch @@ -0,0 +1,80 @@ +diff --git a/examples/launch_tor_endpoint2.py b/examples/launch_tor_endpoint2.py +index 72a24c4..30fc34e 100755 +--- a/examples/launch_tor_endpoint2.py ++++ b/examples/launch_tor_endpoint2.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Here we set up a Twisted Web server and then launch a slave tor + # with a configured hidden service directed at the Web server we set +diff --git a/examples/launch_tor_with_simplehttpd.py b/examples/launch_tor_with_simplehttpd.py +index 6c799c7..1edae61 100755 +--- a/examples/launch_tor_with_simplehttpd.py ++++ b/examples/launch_tor_with_simplehttpd.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # -*- coding: utf-8 -*- + '''Create a new tor node and add a simple http server to it, serving a given + directory over http. The server is single-threaded and very limited. +diff --git a/examples/minimal_endpoint.py b/examples/minimal_endpoint.py +index fc8115d..5fd2499 100755 +--- a/examples/minimal_endpoint.py ++++ b/examples/minimal_endpoint.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + from twisted.internet import reactor + from twisted.internet.endpoints import serverFromString +diff --git a/examples/monitor.py b/examples/monitor.py +index 1f4237c..2e06475 100755 +--- a/examples/monitor.py ++++ b/examples/monitor.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Just listens for a few EVENTs from Tor (INFO NOTICE WARN ERR) and + # prints out the contents, so functions like a log monitor. +diff --git a/examples/stem_relay_descriptor.py b/examples/stem_relay_descriptor.py +index 2c9d1cf..08bd7b4 100755 +--- a/examples/stem_relay_descriptor.py ++++ b/examples/stem_relay_descriptor.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # This shows how to get the detailed information about a + # relay descriptor and parse it into Stem's RelayDescriptor +diff --git a/examples/stream_circuit_logger.py b/examples/stream_circuit_logger.py +index 50a98a1..00949ec 100755 +--- a/examples/stream_circuit_logger.py ++++ b/examples/stream_circuit_logger.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # This uses an IStreamListener and an ICircuitListener to log all + # built circuits and all streams that succeed. +diff --git a/examples/tor_info.py b/examples/tor_info.py +index e1cc8fa..a46244c 100755 +--- a/examples/tor_info.py ++++ b/examples/tor_info.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Simple usage example of TorInfo. This class does some magic so that + # once it's set up, all the attributes it has (or appears to) are +diff --git a/examples/webui_server.py b/examples/webui_server.py +index 28d0367..293989d 100755 +--- a/examples/webui_server.py ++++ b/examples/webui_server.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + from twisted.internet import reactor + from nevow.appserver import NevowSite diff --git a/anda/langs/python/txtorcon/txtorcon.spec b/anda/langs/python/txtorcon/txtorcon.spec new file mode 100644 index 0000000000..0ed1b15ee9 --- /dev/null +++ b/anda/langs/python/txtorcon/txtorcon.spec @@ -0,0 +1,54 @@ +%global pypi_name txtorcon +%global _desc Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction. + +Name: python-%{pypi_name} +Version: 24.8.0 +Release: 1%?dist +Summary: Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction +License: MIT +URL: https://github.com/meejah/txtorcon +Source0: %{pypi_source} +Patch0: shebangs.patch +BuildArch: noarch + +BuildRequires: python3-devel +BuildRequires: python3-wheel +BuildRequires: python3-setuptools +BuildRequires: python3-pip + +Packager: Owen Zimmerman + +%description +%_desc + +%package -n python3-%{pypi_name} +Summary: %{summary} +Provides: txtorcon +%{?python_provide:%python_provide python3-%{pypi_name}} + +%description -n python3-%{pypi_name} +%_desc + +%prep +%autosetup -p1 -n txtorcon-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%pyproject_save_files txtorcon + +%files -n python3-%{pypi_name} -f %{pyproject_files} +%doc README.rst INSTALL +%license LICENSE +%python3_sitelib/twisted/plugins/__pycache__/txtorcon_endpoint_parser.*.pyc +%python3_sitelib/txtorcon-%version.dist-info/* +%python3_sitelib/twisted/plugins/*.py +%{_datadir}/txtorcon/* +%ghost %python3_sitelib/__pycache__/*.cpython-*.pyc +%ghost %python3_sitelib/%{name}/subcommands/__pycache__/*.cpython-*.pyc + +%changelog +* Mon Nov 03 2025 Owen Zimmerman +- Initial commit diff --git a/anda/langs/python/txtorcon/update.rhai b/anda/langs/python/txtorcon/update.rhai new file mode 100644 index 0000000000..9e88efe672 --- /dev/null +++ b/anda/langs/python/txtorcon/update.rhai @@ -0,0 +1 @@ +rpm.version(pypi("txtorcon"));