diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-10 05:13:04 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-10 05:13:04 +0000 |
commit | a1f27cc17110e8c54c10ebce77b53bbe346a3a6b (patch) | |
tree | 78c905f18f26bae83dfa0a56b3ae49b21148d07d | |
parent | 0dacae485f1a6655d0affc2b625d69dee98dc4d4 (diff) |
automatic import of python-bunnypyopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-bunnypy.spec | 429 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 431 insertions, 0 deletions
@@ -0,0 +1 @@ +/BunnyPy-0.3.0.tar.gz diff --git a/python-bunnypy.spec b/python-bunnypy.spec new file mode 100644 index 0000000..eb17a5e --- /dev/null +++ b/python-bunnypy.spec @@ -0,0 +1,429 @@ +%global _empty_manifest_terminate_build 0 +Name: python-BunnyPy +Version: 0.3.0 +Release: 1 +Summary: Lightweight Python Web Framework +License: MIT +URL: https://github.com/ivanlulyf/bunnypy +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/5d/92/84b5d6df4db13120ac3efb8495e58928e177db1ae4ae2a83512979b420e7/BunnyPy-0.3.0.tar.gz +BuildArch: noarch + + +%description +# BunnyPy +a Lightweight Python Web Framework + + + +[](https://pypi.org/project/BunnyPy/) +[](https://pypi.org/project/BunnyPy/) +[](LICENSE) + +English | [中文](README_CN.md) + +## Installation + +```shell +pip install bunnypy +``` + +## Simple Usage + +a HelloWord Application + +```python +from bunnypy import Bunny + +app = Bunny() + +@app.controller +class IndexController: + def ac_index(self): + return 'Hello Bunny' + +if __name__ == '__main__': + app.run() +``` + +## Data Model + +```python +from bunnypy import Bunny +import sqlite3 + +# ------------------------------------------------------------ +# Config database using SQLite3 + +db = Bunny.SQLiteDatabase(sqlite3.connect('test.db'), 'tp_') +app = Bunny(database=db) + +# ------------------------------------------------------------ +# Declare a Model Class + + +@app.data +class Message: + __pk__ = ['id'] + __ai__ = 'id' + id = 'integer not null' + msg = 'text not null' + + def __init__(self, msg=None): + self.msg = msg + + +# ------------------------------------------------------------ +# Create a table + +Message.create() # create a table named "tp_message" + +# ------------------------------------------------------------ +# Insert Data + +Message(msg="New Message").insert() # add a new row into table "tp_message" + +# ------------------------------------------------------------ +# Chained-call style query + +# get one row where msg equals "Test" +Message.where(" msg = ? ",["Test"]).get(['id','msg']) + +# get 10 rows of data starting at position 0 and sort by id in reverse order +size = 10 +start = 0 +Message.where().order(' id desc ').limit(size,start).get_all(['id','msg']) + +``` + +## Template + +```temp.html``` in ```template``` dir + +```html +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Template</title> +</head> +<body> +Output: {{ msg }} +</body> +</html> +``` + +Python code + +```python +from bunnypy import Bunny + +app = Bunny() + +@app.controller +class IndexController: + def ac_index(self): + return app.render('temp.html',{"msg":"Hello World"}) + + +if __name__ == '__main__': + app.run() + +``` + + +%package -n python3-BunnyPy +Summary: Lightweight Python Web Framework +Provides: python-BunnyPy +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-BunnyPy +# BunnyPy +a Lightweight Python Web Framework + + + +[](https://pypi.org/project/BunnyPy/) +[](https://pypi.org/project/BunnyPy/) +[](LICENSE) + +English | [中文](README_CN.md) + +## Installation + +```shell +pip install bunnypy +``` + +## Simple Usage + +a HelloWord Application + +```python +from bunnypy import Bunny + +app = Bunny() + +@app.controller +class IndexController: + def ac_index(self): + return 'Hello Bunny' + +if __name__ == '__main__': + app.run() +``` + +## Data Model + +```python +from bunnypy import Bunny +import sqlite3 + +# ------------------------------------------------------------ +# Config database using SQLite3 + +db = Bunny.SQLiteDatabase(sqlite3.connect('test.db'), 'tp_') +app = Bunny(database=db) + +# ------------------------------------------------------------ +# Declare a Model Class + + +@app.data +class Message: + __pk__ = ['id'] + __ai__ = 'id' + id = 'integer not null' + msg = 'text not null' + + def __init__(self, msg=None): + self.msg = msg + + +# ------------------------------------------------------------ +# Create a table + +Message.create() # create a table named "tp_message" + +# ------------------------------------------------------------ +# Insert Data + +Message(msg="New Message").insert() # add a new row into table "tp_message" + +# ------------------------------------------------------------ +# Chained-call style query + +# get one row where msg equals "Test" +Message.where(" msg = ? ",["Test"]).get(['id','msg']) + +# get 10 rows of data starting at position 0 and sort by id in reverse order +size = 10 +start = 0 +Message.where().order(' id desc ').limit(size,start).get_all(['id','msg']) + +``` + +## Template + +```temp.html``` in ```template``` dir + +```html +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Template</title> +</head> +<body> +Output: {{ msg }} +</body> +</html> +``` + +Python code + +```python +from bunnypy import Bunny + +app = Bunny() + +@app.controller +class IndexController: + def ac_index(self): + return app.render('temp.html',{"msg":"Hello World"}) + + +if __name__ == '__main__': + app.run() + +``` + + +%package help +Summary: Development documents and examples for BunnyPy +Provides: python3-BunnyPy-doc +%description help +# BunnyPy +a Lightweight Python Web Framework + + + +[](https://pypi.org/project/BunnyPy/) +[](https://pypi.org/project/BunnyPy/) +[](LICENSE) + +English | [中文](README_CN.md) + +## Installation + +```shell +pip install bunnypy +``` + +## Simple Usage + +a HelloWord Application + +```python +from bunnypy import Bunny + +app = Bunny() + +@app.controller +class IndexController: + def ac_index(self): + return 'Hello Bunny' + +if __name__ == '__main__': + app.run() +``` + +## Data Model + +```python +from bunnypy import Bunny +import sqlite3 + +# ------------------------------------------------------------ +# Config database using SQLite3 + +db = Bunny.SQLiteDatabase(sqlite3.connect('test.db'), 'tp_') +app = Bunny(database=db) + +# ------------------------------------------------------------ +# Declare a Model Class + + +@app.data +class Message: + __pk__ = ['id'] + __ai__ = 'id' + id = 'integer not null' + msg = 'text not null' + + def __init__(self, msg=None): + self.msg = msg + + +# ------------------------------------------------------------ +# Create a table + +Message.create() # create a table named "tp_message" + +# ------------------------------------------------------------ +# Insert Data + +Message(msg="New Message").insert() # add a new row into table "tp_message" + +# ------------------------------------------------------------ +# Chained-call style query + +# get one row where msg equals "Test" +Message.where(" msg = ? ",["Test"]).get(['id','msg']) + +# get 10 rows of data starting at position 0 and sort by id in reverse order +size = 10 +start = 0 +Message.where().order(' id desc ').limit(size,start).get_all(['id','msg']) + +``` + +## Template + +```temp.html``` in ```template``` dir + +```html +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Template</title> +</head> +<body> +Output: {{ msg }} +</body> +</html> +``` + +Python code + +```python +from bunnypy import Bunny + +app = Bunny() + +@app.controller +class IndexController: + def ac_index(self): + return app.render('temp.html',{"msg":"Hello World"}) + + +if __name__ == '__main__': + app.run() + +``` + + +%prep +%autosetup -n BunnyPy-0.3.0 + +%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-BunnyPy -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.3.0-1 +- Package Spec generated @@ -0,0 +1 @@ +e15655f45ade06c6daaf3b1e8b24431e BunnyPy-0.3.0.tar.gz |