diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-11 16:37:06 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 16:37:06 +0000 |
commit | 2758b1f6dedb50b9b68c91f9b901634a7f70d398 (patch) | |
tree | aa649b4e57e828cc4b4338abedecccd55224e751 | |
parent | fc7c961f7b5d92e7429c1d3fe4c83d25edf43780 (diff) |
automatic import of python-cfunctionsopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-cfunctions.spec | 248 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 250 insertions, 0 deletions
@@ -0,0 +1 @@ +/cfunctions-0.1.196.tar.gz diff --git a/python-cfunctions.spec b/python-cfunctions.spec new file mode 100644 index 0000000..b256fa7 --- /dev/null +++ b/python-cfunctions.spec @@ -0,0 +1,248 @@ +%global _empty_manifest_terminate_build 0 +Name: python-cfunctions +Version: 0.1.196 +Release: 1 +Summary: cfunctions +License: Apache-2.0 +URL: https://github.com/eladb/cfunctions.git +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/21/82/277d75cefad1cc8439a271ecf540612a5da31cd0b0b8df5c593d39155c96/cfunctions-0.1.196.tar.gz +BuildArch: noarch + +Requires: python3-jsii +Requires: python3-publication + +%description +# CFunctions + +CFunctions (cloud functions, compute functions, construct functions) are a +building block of the [constructs programming model] which can be used to +package JavaScript code and run it on a cloud system. + +Let's take a look at a simple CFunction: + +```python +const { CFunction } = require('cfunctions'); + +const cfunc = new CFunction({ + capture: [ 'x', 'y' ], + code: 'x + y' +}); + +console.log('outfile:', cfunc.outfile); +console.log('env:', cfunc.env); +``` + +The output will look like this: + +```shell +outfile: /tmp/.cf.out.TAJEO8/cf.js +env: { __CF__x__: '100', __CF__y__: '200' } +``` + +The `cf.js` file is a a self-contained JavaScript module which can be loaded +through a `require()` statement and returns an async function that executes the +code after binding it from a set of environment variables. + +Let's execute our cfunction: + +```shell +$ export __CF__x__=123 +$ export __CF__y__=10 +$ node -e "require('/tmp/.cf.out.TAJEO8/cf.js')().then(result => console.log(result))" +12310 +``` + +The `CFunction.exec()` static method can also be used to execute the function: + +```js +const result = CFunction.exec('/tmp/.cf.out.TAJEO8/cf.js', { + env: { + __CF__x__: 123, + __CF__y__: 10 + } +}); + +console.log(result); +``` + +## License + +Licensed under the [Apache 2.0](./LICENSE) license. + + + + +%package -n python3-cfunctions +Summary: cfunctions +Provides: python-cfunctions +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-cfunctions +# CFunctions + +CFunctions (cloud functions, compute functions, construct functions) are a +building block of the [constructs programming model] which can be used to +package JavaScript code and run it on a cloud system. + +Let's take a look at a simple CFunction: + +```python +const { CFunction } = require('cfunctions'); + +const cfunc = new CFunction({ + capture: [ 'x', 'y' ], + code: 'x + y' +}); + +console.log('outfile:', cfunc.outfile); +console.log('env:', cfunc.env); +``` + +The output will look like this: + +```shell +outfile: /tmp/.cf.out.TAJEO8/cf.js +env: { __CF__x__: '100', __CF__y__: '200' } +``` + +The `cf.js` file is a a self-contained JavaScript module which can be loaded +through a `require()` statement and returns an async function that executes the +code after binding it from a set of environment variables. + +Let's execute our cfunction: + +```shell +$ export __CF__x__=123 +$ export __CF__y__=10 +$ node -e "require('/tmp/.cf.out.TAJEO8/cf.js')().then(result => console.log(result))" +12310 +``` + +The `CFunction.exec()` static method can also be used to execute the function: + +```js +const result = CFunction.exec('/tmp/.cf.out.TAJEO8/cf.js', { + env: { + __CF__x__: 123, + __CF__y__: 10 + } +}); + +console.log(result); +``` + +## License + +Licensed under the [Apache 2.0](./LICENSE) license. + + + + +%package help +Summary: Development documents and examples for cfunctions +Provides: python3-cfunctions-doc +%description help +# CFunctions + +CFunctions (cloud functions, compute functions, construct functions) are a +building block of the [constructs programming model] which can be used to +package JavaScript code and run it on a cloud system. + +Let's take a look at a simple CFunction: + +```python +const { CFunction } = require('cfunctions'); + +const cfunc = new CFunction({ + capture: [ 'x', 'y' ], + code: 'x + y' +}); + +console.log('outfile:', cfunc.outfile); +console.log('env:', cfunc.env); +``` + +The output will look like this: + +```shell +outfile: /tmp/.cf.out.TAJEO8/cf.js +env: { __CF__x__: '100', __CF__y__: '200' } +``` + +The `cf.js` file is a a self-contained JavaScript module which can be loaded +through a `require()` statement and returns an async function that executes the +code after binding it from a set of environment variables. + +Let's execute our cfunction: + +```shell +$ export __CF__x__=123 +$ export __CF__y__=10 +$ node -e "require('/tmp/.cf.out.TAJEO8/cf.js')().then(result => console.log(result))" +12310 +``` + +The `CFunction.exec()` static method can also be used to execute the function: + +```js +const result = CFunction.exec('/tmp/.cf.out.TAJEO8/cf.js', { + env: { + __CF__x__: 123, + __CF__y__: 10 + } +}); + +console.log(result); +``` + +## License + +Licensed under the [Apache 2.0](./LICENSE) license. + + + + +%prep +%autosetup -n cfunctions-0.1.196 + +%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-cfunctions -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.196-1 +- Package Spec generated @@ -0,0 +1 @@ +dc9a9a5ea31822a4a4cdf8561fb6370d cfunctions-0.1.196.tar.gz |