%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 - 0.1.196-1 - Package Spec generated