Commit Graph

160 Commits

Author SHA1 Message Date
David Hewitt 59dac57689 build: fix support for non-utf8 systems 2021-01-26 23:16:47 +00:00
konstin c8b290a254 build: make abi3 linking work on windows 2021-01-10 10:13:49 +00:00
David Hewitt b152fd6317
Merge pull request #1359 from dalcde/patch-2
Let pyconfig.h not define Py_ENABLE_SHARED
2021-01-05 22:22:50 +00:00
Dexter Chua 8f404c4db5
Let pyconfig.h not define Py_ENABLE_SHARED
If there is no line that defines Py_ENABLE_SHARED in `pyconfig.h`, then it is false
2021-01-04 22:24:39 +08:00
David Hewitt 59707f0b81 auto-initialize: new feature to control initializing Python 2021-01-02 16:08:10 +00:00
David Hewitt a317e0df74 build: use BuildFlags struct 2021-01-01 07:34:36 +00:00
David Hewitt a350dd2c20 build: make include dir optional when targeting Windows 2020-12-31 22:02:29 +00:00
David Hewitt cc6fc483a6 build: remove unused unicode flags 2020-12-31 22:02:29 +00:00
David Hewitt 6fdcfdebe1 build: simplify build script 2020-12-31 22:02:29 +00:00
cecini c780aa931d Fix the pydebug with trace refs and count_allocs for python > 3.7 2020-12-23 16:20:19 +00:00
Yuji Kanagawa 9aa70f7c89
Merge pull request #1263 from PyO3/abi3-min-python
Add abi3-py* features
2020-12-08 12:52:00 +09:00
kngwyu 49143724d5 Rename PYO3_NO_INTERPRETER by PYO3_NO_PYTHON 2020-12-07 17:30:04 +09:00
kngwyu 1b838504b7 Introduce PYO3_NO_INTERPRETER variable for build script 2020-12-01 23:40:49 +09:00
David Hewitt 53ce423424 anaconda: fix for building in a virtualenv 2020-11-21 08:56:07 +00:00
kngwyu 597119d40a Add abi3-py* features 2020-11-16 00:39:54 +09:00
David Hewitt 9617edfca9 msrv: bump to 1.45 2020-11-12 11:33:08 +00:00
David Hewitt cfa586c034 build: not cross-compiling when musl from gnu 2020-11-10 08:31:39 +00:00
Yuji Kanagawa 3b3ba4e3ab
Merge pull request #1152 from PyO3/abi3
Complete abi3 support
2020-10-27 23:30:36 +09:00
David Hewitt b4b5f2323c
build.rs: use inclusive range syntax 2020-10-20 08:53:28 +01:00
Alex Gaynor 90a825d0c2 Merge branch 'master' into abi3-merge-master 2020-10-19 14:32:49 -04:00
David Hewitt afd9b823d2 Drop support for Python 3.5 2020-10-18 19:02:27 +01:00
Alex Gaynor 9e34835b76 Merge branch 'master' into abi3-merge-master 2020-10-12 18:03:14 -04:00
kngwyu 41cfa6b2e9 Don't watch PYTHON_SYS_EXECUTABLE and PATH when unnecessary 2020-10-12 23:22:14 +09:00
Alex Gaynor 140790b15f Merge branch 'master' into abi3-merge-master 2020-10-10 10:11:49 -04:00
Alex Gaynor d8c8c1760e Link python3.lib instead of python3x.lib on Windows in abi3 mode 2020-09-23 08:32:30 -04:00
kngwyu c07e1aa40a Use abi3 feature, instead of unstable-api 2020-09-20 00:06:14 +09:00
Alex Gaynor 62ad53f9fc
Don't consider it cross-compilation when building for 32-bit Windows on 64-bit windows 2020-09-12 19:10:02 -04:00
Rob Thatcher b66a92579c treat Anaconda python as shared 2020-09-11 16:58:33 +01:00
kngwyu 1941f4daef Rename all-apis with unstable-api 2020-09-06 17:37:55 +09:00
kngwyu d2a10b688f Introduce all-apis feature to support abi3 2020-09-05 17:52:41 +09:00
David Hewitt 3fa1639b8c Fix cross-compilation from unix to windows 2020-08-29 11:37:49 +01:00
Rene Leveille 441d7f52b1 apply symlink use case, change variable name 2020-08-19 12:11:14 -04:00
Rene Leveille 455ec80a98 make clippy happy 2020-08-18 22:14:14 -04:00
Rene Leveille 7beb272075 find within general lib dir, with new optional env variable 2020-08-18 22:05:29 -04:00
Rene Leveille 6ddae70a2b fix changelog and added comment for finding sysconfigdata 2020-08-18 13:23:48 -04:00
Rene Leveille 5dc907bc5d apply suggestions from review 2020-08-17 18:14:05 -04:00
Rene Leveille 695be35289 make clippy happy 2020-08-17 15:23:24 -04:00
Rene Leveille afac788c1c fix complexity of finding and parsing 2020-08-17 15:12:12 -04:00
Rene Leveille aef159d4ee appy suggestions from PR 2020-08-17 11:26:30 -04:00
Rene Leveille 3bc951a551 make clippy happy and add to changelog 2020-08-17 11:25:42 -04:00
Rene Leveille e4edc6cdd7 Load compilation options from _sysconfigdata_*.py file
Following the discussion in #1077 this change allows the compilation
script to load the configurations from a _sysconfigdata_ file
in the library directory.

This file is also provided on target systems in the same directory.
At least on Manjaro Linux.
Which could remove the need to run a python script at compile time
for compiling the the host.

I've also addressed the linking need for android in #1082.
2020-08-17 11:25:06 -04:00
David Hewitt 7fe989693c Move fmt and clippy to actions 2020-08-09 12:15:54 +01:00
Yuji Kanagawa ff9cde46e1
Merge pull request #1097 from kngwyu/refactor-buildrs
Refactor build.rs
2020-08-09 18:31:19 +09:00
kngwyu 5ae8639cc8 Refactor build.rs 2020-08-09 18:07:14 +09:00
David Hewitt e0376d24aa Experimental support for PyPy 3.6
Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2020-08-08 14:54:34 +01:00
David Hewitt dc5c2a9b8f Rename PYTHON_SYS_EXECUTABLE to PYO3_PYTHON 2020-08-06 13:27:20 +01:00
kngwyu a840ebbb5a Support Rust 1.39.0 2020-06-18 19:59:40 +09:00
konstin 3180e5cc06 POC stable rust (2 tests failing) 2020-06-18 17:21:09 +09:00
Mara Bos c4e68e6286
Update build.rs and remove serde and regex dependencies. (#896) 2020-05-04 19:51:19 +01:00
Jack O'Connor f3876a90b3 use struct.calcsize("P") rather than platform.machine()
platform.machine() gives the wrong answer if you're running 32-bit
Python on a 64-bit machine.

The reason we don't use platform.architecture() here is that it's not
reliable on macOS. See https://stackoverflow.com/a/1405971/823869.
Similarly, sys.maxsize is not reliable on Windows. See
https://stackoverflow.com/questions/1405913/how-do-i-determine-if-my-python-shell-is-executing-in-32bit-or-64bit-mode-on-os/1405971#comment6209952_1405971
and https://stackoverflow.com/a/3411134/823869.

Also use CARGO_CFG_TARGET_POINTER_WIDTH rather than inferring the Rust
target pointer width from CARGO_CFG_TARGET_ARCH.
2020-03-26 14:01:14 -04:00
kngwyu e67681d018 Refactor build.rs 2020-03-08 22:54:42 +09:00
David Hewitt 24a3fbd4e2 Check python and target arcitecture match in build.rs 2020-02-29 12:24:04 +00:00
kngwyu a6fed34e23 Fix clippy warnings in build.rs and tests 2020-02-10 14:53:13 +09:00
David Hewitt 6c25f6aacc Bump minimum Rust version to 1.42.0-nightly 2020-02-09 10:54:00 +00:00
David Hewitt 20c6c2d463 Fix clippy warnings 2020-02-08 19:25:52 +00:00
kngwyu 3eff3ca504 Remove unnecessary parentheses 2019-11-02 15:18:40 +09:00
namuyan 91b3231038 complicated method chain 2019-10-12 17:00:19 +09:00
namuyan 4b1c48831a catch stdout(others) and stderr(windows) output 2019-10-12 13:13:28 +09:00
namuyan 5d19b9124a check python interpreter by --version 2019-10-12 11:23:27 +09:00
Martin Larralde 9facb20d89 Fix build script always using `python3` in OSX builds 2019-09-15 14:39:22 +02:00
Daniele Esposti fe9575a34d Search for both python3 and python 2019-09-08 09:10:40 +01:00
Daniele Esposti bd426d4065 Use python3 explicitly 2019-09-07 09:43:44 +01:00
kngwyu 21a040b8b4 Change Minimum nightly to 2019-07-19 2019-08-11 16:40:21 +09:00
kngwyu 6dabaf08b3 Update minimum nightly to 1.37 07-12 2019-08-05 16:55:25 +09:00
konstin 1332174e00 Upgrade version check 2019-07-15 13:05:56 +02:00
kngwyu 9f827f024c Update MIN_DATE/VERSION in build.rs 2019-07-09 19:06:50 +09:00
konstin 9eda9e9f80 build.rs configuration as struct instead of strings
Changes the configuration system from passing around a Vec<String> where each entry was a value for a different part of the configuration (with different types, all wrapped in strings) with a `InterpreterConfig` struct.

Also removes some outdated code.
2019-05-16 23:24:55 +02:00
Alexander Niederbühl 21a2f816fc build.rs: Handle `python` being Python 2
If `python` refers to Python 2 (as recommended in [1]) the build fails
with:
  AttributeError: 'module' object has no attribute 'base_prefix'

Since there is no `base_prefix` in Python 2, simply use `exec_prefix` if
the AttributeError is raised.

[1] https://www.python.org/dev/peps/pep-0394/
2019-05-15 23:57:01 +02:00
Azat Ibrakov 134c129edc Fix installing in 'venv' and datetime tests on Windows (#472)
* Add failing test

* Complete formatting

* Fix commands execution

* Fix commands execution for Linux

* Extract virtual environment creation/removing into separate functions

* Complete error messages

* Complete examples building

* Use 'venv' independent path

* Call script by dotted path instead of 'source' call

* Add Travis CI script

* Rename variable: 'exec_prefix' -> 'base_prefix'

* Add AppVeyor script

* Remove Rust test

* Complete shell script mode

* Complete path to powershell script

* Use 'pushd'/'popd' instead of 'cd'

* Complete powershell script

* Complete shell script

* Fix setup

* Use 'tox-venv' plugin for 'venv' stdlib module support

* Remove additional 'venv' testing

* Use global environment instead of calling 'set'

* Use 'tox' for AppVeyor, extract commands into 'setup' & 'test' scripts

* Add updating of 'pip' & 'setuptools'

* Add moving in/back from examples directories

* Complete 'pip'/'setuptools' updating

* Complete requirements

* Complete 'word-count' example configuration

* Simplify 'setup' script

* Complete 'rustapi_module' example tests

* Revert formatting

* Complete examples configuration

* Remove redundant annotations

* Add entry in changelog
2019-05-12 22:20:17 +09:00
Omer BenAmram f8bf258602 Support rust extensions for PyPy via cpyext (#393)
* wip

* removed stuff

* removed another change

* implemented minimum amouth of ifdefs to make pypy3 hello world to compile

* implemented minimum amount of ifdefs to make pypy3 hello world to compile

* hacking on build.rs

* compiler is happy!

* few todos remain

* extracted build logic to seperate module

* added pypy test

* finally fixed pypy structs

* removed some todos

* test should now be machine independent

* fixed all pypy3 symbols

* added pypy feature

* removed `is_pypy`

* added pypy2 declerations also

* fix for cpython2

* improved libpypy detection

* added all pypy2 macros

* fixed errneous type

* more fixes

* fix python2 string macros

* modsupport symbol

* fix

* fixed and added many symbols

* fixes

* remove dup

* remove mac-specific config

* fix all name mangling macros

* unite imports

* missing symbol

* fix pybool

* implemented another missing symbol

* it works

* fix merge conflict

* uncomment non default features

* cargo.toml

* Cargo fmt

* small merge fixes

* use newer build version

* whoops

* fix build script

* more build hacks

* some random hiccups

* small fixes

* it builds!

* it builds and runs

* revert everything in FFI2

* revert changes to ffi2

* check python3 for pypy

* tiny fix

* revert ffi2 for real

* revert weird formatting changes

* bring back missing feature

* tiny error

* fix py3.7 issue

* add pypy3.5 6.0 to travis

* remove dbg!

* another tiny fix

* removed some useless annotations, and fixed inlines annotations

* removed `pretty_assertions`

* removed pypy feature from cargo.toml

* fix for Py_CompileStringFlags

* tox runs word_count!

* __dict__ changes are not supported for PyPy

* fix 3.7 and copy comment

* fix test script 😳

* transfer ownership of strings to cpython when possible

* remove cstr! macro

* added missing nuls

* as_bytes() -> b’’ string

* symbol removed by mistake

* properly shim pypy date time API, some tests are passing!

* extension_module tests now not crashing! (some still skipped)

* maybe travis has new pypy version?

* small error on windows (build script)

* fix conditional compilation

* try to make tests run on travis..

* invert condition

* added pytest-faulthandler to facilitate debugging

* correctly name dir

* use full paths

* say —yes to conda

* fix

* syntax error

* change PATH

* fixed a terrible bug with PyTypeObjects in PyPy

* fix PyTypeObject defs

* re-enabled tests!

* all tests are passing!

* make the fix ad-hoc for now

* removed build module

* revert changes that cause an additional GC bug

* prevented buggy test from failing pypy

* removed unused comment

* don’t run coverage on pypy

* removed some erroneous symbols from function calls which are actually macros

* restore py37 pyunicode missing def

* use only `link_name` in PyPy specific declarations

* only setup PyPy when testing against PyPy

* annotation that was eaten during merge

* remove change to  comment by mistake + unnecessary changes to cargo.toml

* xfail dates test only on pypy

* changed comment to be a little more helpful

* cleaned up some warnings

* Update src/ffi3/ceval.rs

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* @konstin PR notes

* rustfmt

* some documentation

* if configured via env var only, default to cpython

* remove extra unsafe

* refer users to guide for pypy

* Update guide/src/pypy.md

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* Update guide/src/pypy.md

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* @konstin applied patch

* check that pypy at least build

* search explicitly for libpypy

* added note about some known unsupported features

* use ld_version

* export PYTHON_SYS_EXECUTABLE to `cargo build` test

* inverted if

* always link pypy dynamically

* remove unused imports

* Apply @kngwyu’s suggestion

* fix tox configuration

* try conda virtualenv

* try to simply not install python at all inside pypy environment

* setup pypy before using “python"

* use system_site_packages

* revert change to .travis

* moved cpyext datetime documentation to module level, and revised it.

* Update src/ffi/datetime.rs

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* rustfmt

* Update src/ffi/datetime.rs

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* kept only notes that are relevant to users.

* invert if

* use bash and not sh
2019-04-23 13:18:42 +02:00
ijl 2bb0d05a30 Drop support for python2 2019-03-29 12:37:26 +00:00
konstin b2561e9db1 Better error message when python is not on PATH for #414
Example for the new error message:
                                                                                       
   Compiling pyo3 v0.6.0-alpha.4 (/home/konsti/pyo3)
error: failed to run custom build command for `pyo3 v0.6.0-alpha.4 (/home/konsti/pyo3)`
process didn't exit successfully: `/home/konsti/pyo3/target/debug/build/pyo3-bcc3e702033ec884/build-script-build` (exit code: 1)
--- stderr
Error: "Could not find any interpreter at python, are you sure you have python installed on your PATH?"
2019-03-26 12:47:35 +01:00
konstin 7a4cb50c96 Travis cleanup 2019-02-13 21:12:46 +01:00
Matt Pelland 7232323248
rename all cross compile variables to PYO3_CROSS_* prefix 2019-01-30 18:08:04 -05:00
Matt Pelland 8721f410e1
don't bury IO errors in parse_header_defines 2019-01-30 18:08:04 -05:00
Matt Pelland 9f5776f98c
add doc for C #define regex 2019-01-30 18:08:04 -05:00
Matt Pelland 6e4c2b71e0
do not call python interpreter when cross compiling 2019-01-30 18:08:03 -05:00
Alexander Niederbühl 56ad7d806c Remove format! 2019-01-08 20:20:42 +01:00
Alexander Niederbühl 9e2347b810 Don't require feature when PYTHON_SYS_EXECUTABLE is set
If neither the feature python2 or python3 is used, the version of
PYTHON_SYS_EXECUTABLE is used.

Issue #276
2019-01-07 22:46:01 +01:00
konstin 89872dceb9 Replace deprecated methods 2018-12-15 14:15:43 +01:00
konstin be6d7b2408 Fix #258 2018-11-05 00:29:40 +01:00
konstin 0372360811 Add test for #219 2018-09-17 19:47:23 +02:00
konstin 9405ffa3b9 Add section about linking in the guide 2018-09-09 18:49:03 +02:00
konstin d638a51971 A bit more debug info on failed build scripts 2018-09-09 18:14:14 +02:00
konstin 991a8b94d2 More nightly fixes 2018-08-19 20:42:17 +02:00
konstin b12b65cfae Cleanup 2018-08-19 20:06:47 +02:00
konstin d0ed68414a Many small improvements 2018-08-04 19:56:59 +02:00
konstin 2627fa8a08 0.3.2 2018-07-22 21:36:18 +02:00
konstin d59bebcc38 Upgrade from proc_macro to use_extern_macros 2018-07-18 13:08:05 +02:00
konstin 2f1e1a2a3f Simplify building a bit 2018-07-03 20:40:42 +02:00
konstin a6b92c0707 Rerun the build script if any relevant env var changed 2018-05-26 12:04:58 +02:00
konstin 103bde7db1 Improve build script 2018-05-13 15:55:13 +02:00
konstin a6944b6485 Bump minimum rust version
There were some significant changes in last weeks
2018-05-13 15:19:21 +02:00
Nikolay Kim 057660e546 fix python3.7 support 2018-02-21 10:29:14 -08:00
Guanqun Lu 4b26edfa09 display the required version and current version in error message 2017-12-27 18:35:49 +08:00
messense e7a7b3d5a0
Remove use of now unneeded 'AsciiExt' trait 2017-11-23 12:08:05 +08:00
messense 95d94c19b3
Rustup to 1.22.0-nightly 2017-09-30 2017-10-01 20:32:35 +08:00
Nikolay Kim da2db1eb2f bump min version 2017-07-21 12:55:47 -07:00
messense 6bbf3d7595 Add rustc version check in build script (#47)
* Add rustc version check in build script

* Update rustc requirement in README.md
2017-07-18 09:33:27 +08:00
Nikolay Kim 3b4d147219 initial impl for py2 2017-06-11 16:35:24 -07:00