Accepting request 940334 from home:bnavigator:branches:devel:languages:python

- Don't use the same command name as conflicting libproxy:
  Use `proxy-py` instead of `proxy`. (Cannot use `proxy.py` due to
  import problems). Add proxy.py-command.patch

OBS-URL: https://build.opensuse.org/request/show/940334
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-proxy.py?expand=0&rev=2
This commit is contained in:
Matej Cepl 2021-12-14 18:17:59 +00:00 committed by Git OBS Bridge
parent 12d7bd4663
commit 94b3030df3
3 changed files with 160 additions and 6 deletions

143
proxy.py-command.patch Normal file
View File

@ -0,0 +1,143 @@
Index: proxy.py-2.3.1/README.md
===================================================================
--- proxy.py-2.3.1.orig/README.md
+++ proxy.py-2.3.1/README.md
@@ -231,14 +231,14 @@ or from GitHub `master` branch
## From command line when installed using PIP
When `proxy.py` is installed using `pip`,
-an executable named `proxy` is placed under your `$PATH`.
+an executable named `proxy-py` is placed under your `$PATH`.
#### Run it
-Simply type `proxy` on command line to start it with default configuration.
+Simply type `proxy-py` on command line to start it with default configuration.
```bash
- proxy
+ proxy-py
...[redacted]... - Loaded plugin proxy.http_proxy.HttpProxyPlugin
...[redacted]... - Starting 8 workers
...[redacted]... - Started server on ::1:8899
@@ -268,7 +268,7 @@ All the logs above are `INFO` level logs
Lets start `proxy.py` with `DEBUG` level logging:
```bash
- proxy --log-level d
+ proxy-py --log-level d
...[redacted]... - Open file descriptor soft limit set to 1024
...[redacted]... - Loaded plugin proxy.http_proxy.HttpProxyPlugin
...[redacted]... - Started 8 workers
@@ -286,7 +286,7 @@ See [flags](#flags) for full list of ava
## From command line using repo source
If you are trying to run `proxy.py` from source code,
-there is no binary file named `proxy` in the source code.
+there is no binary file named `proxy-py` in the source code.
To start `proxy.py` from source code follow these instructions:
@@ -362,7 +362,7 @@ Add support for short links in your favo
Start `proxy.py` as:
```bash
- proxy \
+ proxy-py \
--plugins proxy.plugin.ShortLinkPlugin
```
@@ -391,7 +391,7 @@ Modifies POST request body before sendin
Start `proxy.py` as:
```bash
- proxy \
+ proxy-py \
--plugins proxy.plugin.ModifyPostDataPlugin
```
@@ -445,7 +445,7 @@ without need of an actual upstream REST
Start `proxy.py` as:
```bash
- proxy \
+ proxy-py \
--plugins proxy.plugin.ProposedRestApiPlugin
```
@@ -476,7 +476,7 @@ also running on `8899` port.
Start `proxy.py` and enable inbuilt web server:
```bash
- proxy \
+ proxy-py \
--enable-web-server \
--plugins proxy.plugin.RedirectToCustomServerPlugin
```
@@ -510,7 +510,7 @@ By default, plugin drops traffic for `go
Start `proxy.py` as:
```bash
- proxy \
+ proxy-py \
--plugins proxy.plugin.FilterByUpstreamHostPlugin
```
@@ -619,7 +619,7 @@ Modifies upstream server responses.
Start `proxy.py` as:
```bash
- proxy \
+ proxy-py \
--plugins proxy.plugin.ManInTheMiddlePlugin
```
@@ -804,7 +804,7 @@ make https-certificates
Start `proxy.py` as:
```bash
- proxy \
+ proxy-py \
--cert-file https-cert.pem \
--key-file https-key.pem
```
@@ -853,7 +853,7 @@ Lets also enable `CacheResponsePlugin` s
response from the server. Start `proxy.py` as:
```bash
- proxy \
+ proxy-py \
--plugins proxy.plugin.CacheResponsesPlugin \
--ca-key-file ca-key.pem \
--ca-cert-file ca-cert.pem \
@@ -1052,7 +1052,7 @@ Start `proxy.py` as:
```bash
# On localhost
- proxy --enable-tunnel \
+ proxy-py --enable-tunnel \
--tunnel-username username \
--tunnel-hostname ip.address.or.domain.name \
--tunnel-port 22 \
@@ -1669,7 +1669,7 @@ few obvious ones include:
# Flags
```bash
- proxy -h
+ proxy-py -h
usage: proxy [-h] [--threadless] [--backlog BACKLOG] [--enable-events]
[--hostname HOSTNAME] [--port PORT] [--num-workers NUM_WORKERS]
[--client-recvbuf-size CLIENT_RECVBUF_SIZE] [--key-file KEY_FILE]
Index: proxy.py-2.3.1/setup.py
===================================================================
--- proxy.py-2.3.1.orig/setup.py
+++ proxy.py-2.3.1/setup.py
@@ -40,7 +40,7 @@ if __name__ == '__main__':
install_requires=open('requirements.txt', 'r').read().strip().split(),
entry_points={
'console_scripts': [
- 'proxy = proxy:entry_point'
+ 'proxy-py = proxy:entry_point'
]
},
classifiers=[

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Dec 13 17:33:03 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Don't use the same command name as conflicting libproxy:
Use `proxy-py` instead of `proxy`. (Cannot use `proxy.py` due to
import problems). Add proxy.py-command.patch
-------------------------------------------------------------------
Sat Dec 11 19:50:52 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@ -26,12 +26,14 @@ License: BSD-3-Clause
URL: https://github.com/abhinavsingh/proxy.py
# PyPI sdist does not have tests, use Github source
Source: https://github.com/abhinavsingh/proxy.py/archive/refs/tags/v%{version}.tar.gz#/proxy.py-%{version}-gh.tar.gz
# PATCH-FIX-OPENSUSE proxy.py-command.patch -- deconflict with libproxy, code@bnavigator.de
Patch0: proxy.py-command.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-typing-extensions >= 3.7.4.3
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires(postun):update-alternatives
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module pytest}
@ -44,30 +46,32 @@ BuildRequires: openssl
Fast, Lightweight, Pluggable, TLS interception capable proxy server
focused on Network monitoring, controls & Application development, testing, debugging.
Note: On SUSE distributions, the command is installed as proxy-py not as proxy.
%prep
%setup -q -n proxy.py-%{version}
%autosetup -p1 -n proxy.py-%{version}
%build
%python_build
%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/proxy
%python_clone -a %{buildroot}%{_bindir}/proxy-py
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%post
%python_install_alternative proxy
%python_install_alternative proxy-py
%postun
%python_uninstall_alternative proxy
%python_uninstall_alternative proxy-py
%files %{python_files}
%doc README.md
%license LICENSE
%python_alternative %{_bindir}/proxy
%python_alternative %{_bindir}/proxy-py
%{python_sitelib}/proxy
%{python_sitelib}/proxy.py-%{version}*-info