- Add patch support-gast-0.6.patch:
* Support gast 0.6.0 changes, change Requires appropriately. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pythran?expand=0&rev=48
This commit is contained in:
commit
ec3fa17564
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
5
_multibuild
Normal file
5
_multibuild
Normal file
@ -0,0 +1,5 @@
|
||||
<multibuild>
|
||||
<package>test-py310</package>
|
||||
<package>test-py311</package>
|
||||
<package>test-py312</package>
|
||||
</multibuild>
|
6
python-pythran-rpmlintrc
Normal file
6
python-pythran-rpmlintrc
Normal file
@ -0,0 +1,6 @@
|
||||
# SECTION This is a package that compiles code, the runtime requires devel packages
|
||||
addFilter('devel-file-in-non-devel-package .*/site-packages/pythran/.*')
|
||||
addFilter('devel-dependency .*')
|
||||
addFilter('python-leftover-require python.*-numpy-devel')
|
||||
# these are "default" headers for packages
|
||||
addFilter('hidden-file-or-dir .*/\.hpp')
|
221
python-pythran.changes
Normal file
221
python-pythran.changes
Normal file
@ -0,0 +1,221 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 31 04:32:03 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch support-gast-0.6.patch:
|
||||
* Support gast 0.6.0 changes, change Requires appropriately.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Jun 30 20:49:58 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- limit to gast < 0.6.0
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jun 6 20:22:44 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 0.16.1:
|
||||
* Fix massive memory leakage in all ndarray
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat May 25 10:35:26 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Update to 0.16.0
|
||||
* Support numpy.vectorize, numpy.argsort's kind keyword,
|
||||
real/imag on numpy_iexpr
|
||||
* Add missing omp.set_num_thread descriptor
|
||||
* Provide --trace-allocations switch
|
||||
* Support empty PYTHRANRC for reproducible builds
|
||||
* Improve compilation time
|
||||
* Support ufunc creation through #pythran export ufunc
|
||||
func_name(arg_types...)
|
||||
* Fix memory leak when returing numpy_gexpr to Python
|
||||
* Numpy 2.x support
|
||||
* Upgrade xsimd to 13.0.0
|
||||
* Improve detection of non-overlapping memory area during gexpr
|
||||
assignment
|
||||
* Improve python 3.12 support (distutils removal)
|
||||
* Support imatmul
|
||||
* Only link blas when needed
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 25 09:21:21 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Refactor the multibuild test flavor logic
|
||||
- Accomodate some 15.x intricacies for the failing tests:
|
||||
* use netlib lapack/blas instead of openblas
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 23 12:24:06 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||
|
||||
- Use newly supported shrink{} on OBS to exclude python flavors
|
||||
will all python versions skipped.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Feb 17 19:56:24 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Yet another fix of the python39 test skip
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 7 13:53:21 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Fix python312 tests: Force linking to openblas with custom
|
||||
pythranrc
|
||||
- Remove test skips no longer needed
|
||||
- Make test flavors future proof: Don't fail on empty buildset
|
||||
- Skip python39 for all test flavors: The test-py39 multibuild has
|
||||
already been removed but it is still in the build set, so don't
|
||||
test it in the other multibuilds.
|
||||
- Debundle xsimd
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 6 11:05:29 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 0.15.0:
|
||||
* Use pyproject.toml to store setup and build configuration
|
||||
* Upgrade xsimd to a48ab430d4b84ecd5449180ee1c6d2eed67c4191
|
||||
* Improve detection of non-overlapping memory area during gexpr
|
||||
assignment
|
||||
* Support python 3.12
|
||||
* Support list.clear
|
||||
* Improve detection of methods uses as functions
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 6 09:05:01 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- drop python39 from testing, add python312
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 29 04:27:01 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Prepare for Python 3.12, by skipping it for the other test flavors, and
|
||||
adding one for it.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 21 06:35:39 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Update to 0.14.0:
|
||||
* Numpy compatibility - update signatures, complex number handling, long
|
||||
double support
|
||||
* Lazyly import top-level modules and submodules
|
||||
* Improve array indexing by an array
|
||||
* Require at least clang 7 or gcc 8
|
||||
* Make pythran compilation reproducible
|
||||
* Support np.roll with multiple axis
|
||||
* Support numpy.ndarray.view
|
||||
* Improve list resizing speed
|
||||
* Fix bug when filtering an empty sequence
|
||||
- Drop patches, now included upstream:
|
||||
* numpy-longdouble.patch
|
||||
* numpy-complex.patch
|
||||
- Switch to pyproject macros.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 8 16:00:58 UTC 2023 - ecsos <ecsos@opensuse.org>
|
||||
|
||||
- Fix build error in Leap, because it must not be two "Patch:" lines.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 27 10:10:55 UTC 2023 - Markéta Machová <mmachova@suse.com>
|
||||
|
||||
- Add upstream numpy-longdouble.patch and numpy-complex.patch to support new numpy
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jun 10 17:53:22 UTC 2023 - ecsos <ecsos@opensuse.org>
|
||||
|
||||
- Add %{?sle15_python_module_pythons}
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon May 15 15:19:41 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 0.13.1:
|
||||
* Bump xsimd dependency to 11.0.0, with a backported patch.
|
||||
* Improve performance of functions revieving scalar arguments.
|
||||
This changes the internal function call API.
|
||||
* Improve performance of fix-stride slicing, using a new slice
|
||||
representation.
|
||||
* Improve numpy.copyto performance, and detect copyto pattern usage.
|
||||
* Force internal linkage of generated functions, which gives more
|
||||
optimization room to the C++ compiler.
|
||||
* Provide entry points pythran.import_pythrancode and
|
||||
pythran.import_pythranfile, as a poor man JIT option.
|
||||
* Optimize numpy.argmax(cst * val) into numpy.argmax(val) when cst is
|
||||
positive.
|
||||
* Avoid copies upon numpy.array_split
|
||||
* Get rid of unused functions C++ warnings
|
||||
* Avoid generating a loop footer when the loop index is not used
|
||||
outside of the loop.
|
||||
- fix the test-flavor splitting for python311
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 25 10:22:53 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 0.12.1:
|
||||
* Bump xsimd depdency to 10.0.0
|
||||
* Correctly raise KeyError when getting an unset dict item
|
||||
* Fix negative binomial implementation
|
||||
* Correctly convert strided array with offset
|
||||
* Support np.clip(v, None, x) and np.clip(v, x, None)
|
||||
* Support scipy.special.ndtr, scipy.special.ndtri, scipy.special.gammaincinv
|
||||
* Fix set intersection
|
||||
* Support numpy.fft.fftn
|
||||
* Support axis parameter in numpy.argsort
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Dec 25 11:01:09 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Revert. 2046-fix-cli-doc-test.patch did not fix the tests.
|
||||
gh#serge-sans-paille/pythran#2046
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Dec 17 14:32:56 UTC 2022 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add 2046-fix-cli-doc-test.patch to fix failing tests
|
||||
(gh#serge-sans-paille/pythran#2046).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 25 01:54:50 UTC 2022 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Skip also failing test_toolchain and test_cli
|
||||
(gh#serge-sans-paille/pythran#2044) tests.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 11 08:41:50 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Update to 0.12.0
|
||||
* Improve numpy expression computation speed
|
||||
* Decent ICC support (fixing an issue from 2018!)
|
||||
* Much faster C++ code generation
|
||||
* Complete rework of constant folder
|
||||
* Support C++-time evaluation of numpy.ndarray.ndim
|
||||
* Improved omp declare reduction support
|
||||
* Allow indexing of ndarray by integers of mixed types
|
||||
* A lot of small pesty bug fixes in the C++ headers
|
||||
- Drop patches
|
||||
* gcc12-fixes.patch
|
||||
* pythran-pr1984-fixdistutils.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 18 12:24:47 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Add pythran-pr1984-fixdistutils.patch
|
||||
* gh#serge-sans-paille/pythran#1984
|
||||
* Fixes gh#serge-sans-paille/pythran#1984 with setuptools >= 60
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 15 07:59:46 UTC 2022 - Martin Liška <mliska@suse.cz>
|
||||
|
||||
- Add gcc12-fixes.patch in order to fix GCC 12 building issues.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 28 18:47:52 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Fix errors uncovered by staging:
|
||||
* Mention python-pythran-rpmlintrc
|
||||
* also make :test-py* noarch so that no debuginfo package fails
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Jan 23 15:10:57 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Initial specfile for 0.11
|
||||
* debundling inspired by Fedora package:
|
||||
https://src.fedoraproject.org/rpms/pythran/blob/rawhide/f/pythran.spec
|
||||
- Required by scipy 1.7
|
157
python-pythran.spec
Normal file
157
python-pythran.spec
Normal file
@ -0,0 +1,157 @@
|
||||
#
|
||||
# spec file for package python-pythran
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%global flavor @BUILD_FLAVOR@%{nil}
|
||||
%{?sle15_python_module_pythons}
|
||||
|
||||
%if "%{flavor}" == ""
|
||||
%define psuffix %{nil}
|
||||
%bcond_with test
|
||||
%else
|
||||
%define psuffix -%{flavor}
|
||||
%bcond_without test
|
||||
%if "%{flavor}" != "test-py310"
|
||||
%define skip_python310 1
|
||||
%endif
|
||||
%if "%{flavor}" != "test-py311"
|
||||
%define skip_python311 1
|
||||
%endif
|
||||
%if "%{flavor}" != "test-py312"
|
||||
%define skip_python312 1
|
||||
%endif
|
||||
# Skip empty buildsets, last one is for sle15_python_module_pythons
|
||||
%if "%{shrink:%{pythons}}" == "" || ("%pythons" == "python311" && 0%{?skip_python311})
|
||||
ExclusiveArch: donotbuild
|
||||
%define python_module() %flavor-not-enabled-in-buildset-for-suse-%{?suse_version}
|
||||
%else
|
||||
ExclusiveArch: x86_64
|
||||
%endif
|
||||
%endif
|
||||
|
||||
Name: python-pythran%{psuffix}
|
||||
Version: 0.16.1
|
||||
Release: 0
|
||||
Summary: Ahead of Time compiler for numeric kernels
|
||||
License: BSD-3-Clause
|
||||
URL: https://github.com/serge-sans-paille/pythran
|
||||
# Tests are only availble from the github archive
|
||||
Source0: https://github.com/serge-sans-paille/pythran/archive/refs/tags/%{version}.tar.gz#/pythran-%{version}-gh.tar.gz
|
||||
Source99: python-pythran-rpmlintrc
|
||||
# PATCH-FIX-UPSTREAM gh#serge-sans-paille/pythran#840a0e706ec39963aec6bcd1f118bf33177c20b4
|
||||
Patch0: support-gast-0.6.patch
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-beniget >= 0.4.0
|
||||
Requires: python-numpy
|
||||
Requires: python-ply >= 3.4
|
||||
Requires: python-setuptools
|
||||
Requires: (python-gast >= 0.6.0 with python-gast < 0.7.0)
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
# SECTION This is a package that compiles code, the runtime requires devel packages
|
||||
Requires: boost-devel
|
||||
Requires: gcc-c++
|
||||
Requires: python-devel
|
||||
Requires: python-numpy-devel
|
||||
Requires: xsimd-devel >= 13.0.0
|
||||
# /SECTION
|
||||
%if %{with test}
|
||||
BuildRequires: %{python_module ipython}
|
||||
BuildRequires: %{python_module packaging}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module pytest-xdist}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module pythran = %{version}}
|
||||
BuildRequires: %{python_module wheel}
|
||||
%if 0%{?suse_version} > 1500
|
||||
BuildRequires: openblas-devel
|
||||
%else
|
||||
BuildRequires: cblas-devel
|
||||
BuildRequires: lapack-devel
|
||||
%endif
|
||||
BuildRequires: unzip
|
||||
%endif
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
Ahead of Time compiler for numeric kernels
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n pythran-%{version}
|
||||
|
||||
find -name '*.hpp' -exec chmod -x {} +
|
||||
sed -i '1{/env python/d}' pythran/run.py
|
||||
|
||||
# remove embedded VIM swap files
|
||||
find -type f -name "*.swp" -delete
|
||||
|
||||
# Remove bundled header libs and use the ones from system
|
||||
rm -r pythran/boost pythran/xsimd
|
||||
|
||||
%build
|
||||
%if !%{with test}
|
||||
%pyproject_wheel
|
||||
%endif
|
||||
|
||||
%install
|
||||
%if !%{with test}
|
||||
%pyproject_install
|
||||
%python_clone -a %{buildroot}%{_bindir}/pythran
|
||||
%python_clone -a %{buildroot}%{_bindir}/pythran-config
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
%endif
|
||||
|
||||
%if %{with test}
|
||||
%check
|
||||
export CFLAGS="%{optflags}"
|
||||
%if 0%{?suse_version} > 1500
|
||||
# Force to link against openblas during tests because the update-alternatives setup
|
||||
# for lapack/cblas/openblas might be inconsistent inside obs builds
|
||||
cat > config.pythranrc <<EOF
|
||||
[compiler]
|
||||
blas=openblas
|
||||
libs=openblas
|
||||
EOF
|
||||
export PYTHRANRC=$PWD/config.pythranrc
|
||||
%endif
|
||||
# pytest_extra_args is for debug builds with local defines on command line
|
||||
%pytest %{?jobs:-n %jobs} %{?pytest_extra_args}
|
||||
%endif
|
||||
|
||||
%if !%{with test}
|
||||
%post
|
||||
%python_install_alternative pythran pythran-config
|
||||
|
||||
%postun
|
||||
%python_uninstall_alternative pythran
|
||||
|
||||
%files %{python_files}
|
||||
%doc AUTHORS Changelog README.rst
|
||||
%license LICENSE
|
||||
%python_alternative %{_bindir}/pythran
|
||||
%python_alternative %{_bindir}/pythran-config
|
||||
%{python_sitelib}/pythran
|
||||
%{python_sitelib}/omp
|
||||
%{python_sitelib}/pythran-%{version}.dist-info
|
||||
%endif
|
||||
|
||||
%changelog
|
3
pythran-0.16.1-gh.tar.gz
Normal file
3
pythran-0.16.1-gh.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a2510f370a7d62761844daa112a455785e5a6a216cf9ae704c3926fe68eb65ce
|
||||
size 3680817
|
76
support-gast-0.6.patch
Normal file
76
support-gast-0.6.patch
Normal file
@ -0,0 +1,76 @@
|
||||
From 840a0e706ec39963aec6bcd1f118bf33177c20b4 Mon Sep 17 00:00:00 2001
|
||||
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
|
||||
Date: Sat, 29 Jun 2024 19:13:02 +0200
|
||||
Subject: [PATCH] Bump gast requirement to 0.6.0
|
||||
|
||||
This mostly helps for harmonious behavior wrt. gast.dump
|
||||
---
|
||||
docs/TUTORIAL.rst | 8 ++++----
|
||||
pythran/utils.py | 2 +-
|
||||
requirements.txt | 2 +-
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/docs/TUTORIAL.rst b/docs/TUTORIAL.rst
|
||||
index 09f6902f9..7692547eb 100644
|
||||
--- a/docs/TUTORIAL.rst
|
||||
+++ b/docs/TUTORIAL.rst
|
||||
@@ -20,7 +20,7 @@ Python ships a standard module, ``ast`` to turn Python code into an AST. For ins
|
||||
>>> code = "a=1"
|
||||
>>> tree = ast.parse(code) # turn the code into an AST
|
||||
>>> print(ast.dump(tree)) # view it as a string
|
||||
- Module(body=[Assign(targets=[Name(id='a', ctx=Store(), annotation=None, type_comment=None)], value=Constant(value=1, kind=None), type_comment=None)], type_ignores=[])
|
||||
+ Module(body=[Assign(targets=[Name(id='a', ctx=Store())], value=Constant(value=1, kind=None))])
|
||||
|
||||
Deciphering the above line, one learns that the single assignment is parsed as
|
||||
a module containing a single statement, which is an assignment to a single
|
||||
@@ -33,7 +33,7 @@ Eventually, one needs to parse more complex codes, and things get a bit more cry
|
||||
... return n if n< 2 else fib(n-1) + fib(n-2)"""
|
||||
>>> tree = ast.parse(fib_src)
|
||||
>>> print(ast.dump(tree))
|
||||
- Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param(), annotation=None, type_comment=None)], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), ops=[Lt()], comparators=[Constant(value=2, kind=None)]), body=Name(id='n', ctx=Load(), annotation=None, type_comment=None), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=1, kind=None))], keywords=[]), op=Add(), right=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=2, kind=None))], keywords=[]))))], decorator_list=[], returns=None, type_comment=None)], type_ignores=[])
|
||||
+ Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param())]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load()), ops=[Lt()], comparators=[Constant(value=2, kind=None)]), body=Name(id='n', ctx=Load()), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=1, kind=None))]), op=Add(), right=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=2, kind=None))]))))])])
|
||||
|
||||
The idea remains the same. The whole Python syntax is described in
|
||||
http://docs.python.org/2/library/ast.html and is worth a glance, otherwise
|
||||
@@ -199,7 +199,7 @@ constant expressions. In the previous code, there is only two constant
|
||||
|
||||
>>> ce = pm.gather(analyses.ConstantExpressions, tree)
|
||||
>>> sorted(map(ast.dump, ce))
|
||||
- ["Attribute(value=Name(id='math', ctx=Load(), annotation=None, type_comment=None), attr='cos', ctx=Load())", 'Constant(value=3, kind=None)']
|
||||
+ ["Attribute(value=Name(id='math', ctx=Load()), attr='cos', ctx=Load())", 'Constant(value=3, kind=None)']
|
||||
|
||||
One of the most critical analyse of Pythran is the points-to analysis. There
|
||||
are two flavors of this analyse, one that computes an over-set of the aliased
|
||||
@@ -210,7 +210,7 @@ variable, and one that computes an under set. ``Aliases`` computes an over-set::
|
||||
>>> al = pm.gather(analyses.Aliases, tree)
|
||||
>>> returned = tree.body[-1].body[-1].value
|
||||
>>> print(ast.dump(returned))
|
||||
- Name(id='b', ctx=Load(), annotation=None, type_comment=None)
|
||||
+ Name(id='b', ctx=Load())
|
||||
>>> sorted(a.id for a in al[returned])
|
||||
['c', 'd']
|
||||
|
||||
diff --git a/pythran/utils.py b/pythran/utils.py
|
||||
index 2d7a67327..55a7e8ad6 100644
|
||||
--- a/pythran/utils.py
|
||||
+++ b/pythran/utils.py
|
||||
@@ -106,7 +106,7 @@ def get_variable(assignable):
|
||||
... slice=ast.Name('j', ast.Load(), None, None),
|
||||
... ctx=ast.Load())
|
||||
>>> ast.dump(get_variable(ref))
|
||||
- "Name(id='a', ctx=Load(), annotation=None, type_comment=None)"
|
||||
+ "Name(id='a', ctx=Load())"
|
||||
"""
|
||||
msg = "Only name and subscript can be assigned."
|
||||
assert isinstance(assignable, (ast.Name, ast.Subscript)), msg
|
||||
diff --git a/requirements.txt b/requirements.txt
|
||||
index fd6a738e5..c7a25c52a 100644
|
||||
--- a/requirements.txt
|
||||
+++ b/requirements.txt
|
||||
@@ -1,5 +1,5 @@
|
||||
ply>=3.4
|
||||
setuptools
|
||||
-gast~=0.5.0
|
||||
+gast~=0.6.0
|
||||
numpy
|
||||
beniget~=0.4.0
|
Loading…
Reference in New Issue
Block a user