summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-31 05:12:21 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-31 05:12:21 +0000
commit7b16b4bb4f2fc4749ce41cdc957d9a29c0af23b1 (patch)
tree188fbc2051168cd4f75412a6e6acb04b5f7c1a2d
parentfbc725cc87dbfec18b3599df621f2c633ce715bd (diff)
automatic import of python-dhttp
-rw-r--r--.gitignore1
-rw-r--r--python-dhttp.spec272
-rw-r--r--sources1
3 files changed, 274 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..c1bb00a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/dhttp-1.3.3.tar.gz
diff --git a/python-dhttp.spec b/python-dhttp.spec
new file mode 100644
index 0000000..cbb5c78
--- /dev/null
+++ b/python-dhttp.spec
@@ -0,0 +1,272 @@
+%global _empty_manifest_terminate_build 0
+Name: python-dhttp
+Version: 1.3.3
+Release: 1
+Summary: A simple, dynamic, decorator-based HTTP server inspired by Node.js's Express. Supports trio, TLS and WebSockets.
+License: MIT
+URL: https://pypi.org/project/dhttp/
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f4/84/102227e6ff6711c6272ff4d10dc1b4576f09628cb4c1dc86dea37ac59437/dhttp-1.3.3.tar.gz
+BuildArch: noarch
+
+Requires: python3-trio
+Requires: python3-typing
+Requires: python3-Jinja2
+Requires: python3-setuptools
+Requires: python3-pyOpenSSL
+
+%description
+# dhttp
+
+**dhttp**, which is pretty short for _decorable HTTP_, is a
+simple, yet dynamic, HTTP server written for Python 3.
+It is inspired by Node.js's Express library.
+
+"Decorable" is a reference to how extensively decorators are
+used throughout this project. They are very useful, and
+are one of the nicest syntaxes for a callback system like
+this.
+
+## Example code
+
+ import dhttp
+ import random
+
+ app = dhttp.DHTTPServer(int(sys.argv[1]) if len(sys.argv) > 1 else 8005)
+
+ app.alias('/index', '/')
+ app.alias('/index.htm', '/')
+ app.alias('/index.html', '/')
+
+ test_index = """<!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8" />
+ <title>My first DHTTP server</title>
+ </head>
+
+ <body>
+ <p><h2>Congratulations!</h2></p>
+ <hr>
+ <p><b>dhttp {version}</b> is now running on your machine.</p>
+ <p>How about <i>{party}</i> to comemorate? :)</p>
+ </body>
+ </html>"""
+
+ party_stuff = [
+ 'a bottle of wine', 'a bottle of champagne', 'a big party',
+ 'THE party, just', 'THE party', 'lots of cats', 'partyception',
+ 'balloons and cakes', 'a big-endian cake', 'lots of confetti',
+ 'the Confetti-o-Tron 2000', 'HTTP juice', 'Spicy Bytes',
+ 'antimatter', 'cats writing code', 'a smile breaking the 4th wall'
+ ]
+
+ @app.get('/')
+ def serve_index(req, res):
+ res.end(test_index.format(
+ party = random.choice(party_stuff),
+ version = DHTTP_VERSION
+ ))
+
+ @app.on_log
+ def print_log(log):
+ if log.request.get_header('X-Forwarded-For') is not None:
+ log.ip = log.request.get_header('X-Forwarded-For')
+ print(log, ' (forwarded)')
+
+ else:
+ print(log)
+
+ @app.serve_forever
+ def on_serve():
+ print(f" == Listening on port: {app.port} ==")
+
+
+
+%package -n python3-dhttp
+Summary: A simple, dynamic, decorator-based HTTP server inspired by Node.js's Express. Supports trio, TLS and WebSockets.
+Provides: python-dhttp
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-dhttp
+# dhttp
+
+**dhttp**, which is pretty short for _decorable HTTP_, is a
+simple, yet dynamic, HTTP server written for Python 3.
+It is inspired by Node.js's Express library.
+
+"Decorable" is a reference to how extensively decorators are
+used throughout this project. They are very useful, and
+are one of the nicest syntaxes for a callback system like
+this.
+
+## Example code
+
+ import dhttp
+ import random
+
+ app = dhttp.DHTTPServer(int(sys.argv[1]) if len(sys.argv) > 1 else 8005)
+
+ app.alias('/index', '/')
+ app.alias('/index.htm', '/')
+ app.alias('/index.html', '/')
+
+ test_index = """<!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8" />
+ <title>My first DHTTP server</title>
+ </head>
+
+ <body>
+ <p><h2>Congratulations!</h2></p>
+ <hr>
+ <p><b>dhttp {version}</b> is now running on your machine.</p>
+ <p>How about <i>{party}</i> to comemorate? :)</p>
+ </body>
+ </html>"""
+
+ party_stuff = [
+ 'a bottle of wine', 'a bottle of champagne', 'a big party',
+ 'THE party, just', 'THE party', 'lots of cats', 'partyception',
+ 'balloons and cakes', 'a big-endian cake', 'lots of confetti',
+ 'the Confetti-o-Tron 2000', 'HTTP juice', 'Spicy Bytes',
+ 'antimatter', 'cats writing code', 'a smile breaking the 4th wall'
+ ]
+
+ @app.get('/')
+ def serve_index(req, res):
+ res.end(test_index.format(
+ party = random.choice(party_stuff),
+ version = DHTTP_VERSION
+ ))
+
+ @app.on_log
+ def print_log(log):
+ if log.request.get_header('X-Forwarded-For') is not None:
+ log.ip = log.request.get_header('X-Forwarded-For')
+ print(log, ' (forwarded)')
+
+ else:
+ print(log)
+
+ @app.serve_forever
+ def on_serve():
+ print(f" == Listening on port: {app.port} ==")
+
+
+
+%package help
+Summary: Development documents and examples for dhttp
+Provides: python3-dhttp-doc
+%description help
+# dhttp
+
+**dhttp**, which is pretty short for _decorable HTTP_, is a
+simple, yet dynamic, HTTP server written for Python 3.
+It is inspired by Node.js's Express library.
+
+"Decorable" is a reference to how extensively decorators are
+used throughout this project. They are very useful, and
+are one of the nicest syntaxes for a callback system like
+this.
+
+## Example code
+
+ import dhttp
+ import random
+
+ app = dhttp.DHTTPServer(int(sys.argv[1]) if len(sys.argv) > 1 else 8005)
+
+ app.alias('/index', '/')
+ app.alias('/index.htm', '/')
+ app.alias('/index.html', '/')
+
+ test_index = """<!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8" />
+ <title>My first DHTTP server</title>
+ </head>
+
+ <body>
+ <p><h2>Congratulations!</h2></p>
+ <hr>
+ <p><b>dhttp {version}</b> is now running on your machine.</p>
+ <p>How about <i>{party}</i> to comemorate? :)</p>
+ </body>
+ </html>"""
+
+ party_stuff = [
+ 'a bottle of wine', 'a bottle of champagne', 'a big party',
+ 'THE party, just', 'THE party', 'lots of cats', 'partyception',
+ 'balloons and cakes', 'a big-endian cake', 'lots of confetti',
+ 'the Confetti-o-Tron 2000', 'HTTP juice', 'Spicy Bytes',
+ 'antimatter', 'cats writing code', 'a smile breaking the 4th wall'
+ ]
+
+ @app.get('/')
+ def serve_index(req, res):
+ res.end(test_index.format(
+ party = random.choice(party_stuff),
+ version = DHTTP_VERSION
+ ))
+
+ @app.on_log
+ def print_log(log):
+ if log.request.get_header('X-Forwarded-For') is not None:
+ log.ip = log.request.get_header('X-Forwarded-For')
+ print(log, ' (forwarded)')
+
+ else:
+ print(log)
+
+ @app.serve_forever
+ def on_serve():
+ print(f" == Listening on port: {app.port} ==")
+
+
+
+%prep
+%autosetup -n dhttp-1.3.3
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-dhttp -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 1.3.3-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..53d9fcc
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+788ac8ca5c16336439d7a1a38329669b dhttp-1.3.3.tar.gz