diff options
author | Hubert Tong <hubert.reinterpretcast@gmail.com> | 2019-09-15 22:28:39 +0000 |
---|---|---|
committer | Hubert Tong <hubert.reinterpretcast@gmail.com> | 2019-09-15 22:28:39 +0000 |
commit | 3a25f4a9665ecb55e71a4c026e26ed382800cb46 (patch) | |
tree | 6ef961c37147b21b0e582d38527ebe13b8c3e4d5 | |
parent | f3d3f2574e48a0ee794290b7d1163b198ae4a409 (diff) |
[LNT] Python 3 support: Set up (client) setup requirements
Summary:
Changes required to allow setup of a LNT client with Python 3.
- Use `PyModule_Create` instead of `Py_InitModule`
- Drop `argparse` and `wsgiref` install requirements
- Require Python 2.7 or higher in `setup.py`; Python 2.7 is needed for
some Python 3 support idioms
Reviewers: cmatthews, thopre, kristof.beyls
Reviewed By: cmatthews
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D67533
git-svn-id: https://llvm.org/svn/llvm-project/lnt/trunk@371943 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lnt/testing/profile/cPerf.cpp | 20 | ||||
-rw-r--r-- | requirements.client.txt | 2 | ||||
-rw-r--r-- | setup.py | 5 |
3 files changed, 24 insertions, 3 deletions
diff --git a/lnt/testing/profile/cPerf.cpp b/lnt/testing/profile/cPerf.cpp index df823f6..fb5f7b3 100644 --- a/lnt/testing/profile/cPerf.cpp +++ b/lnt/testing/profile/cPerf.cpp @@ -812,7 +812,25 @@ static PyMethodDef cPerfMethods[] = {{"importPerf", cPerf_importPerf, "Import perf.data from a filename"}, {NULL, NULL, 0, NULL}}; -PyMODINIT_FUNC initcPerf(void) { (void)Py_InitModule("cPerf", cPerfMethods); } +#if PY_MAJOR_VERSION >= 3 +static PyModuleDef cPerfModuleDef = {PyModuleDef_HEAD_INIT, + "cPerf", + nullptr, + -1, + cPerfMethods, + nullptr, + nullptr, + nullptr, + nullptr}; +#endif + +PyMODINIT_FUNC initcPerf(void) { +#if PY_MAJOR_VERSION >= 3 + return PyModule_Create(&cPerfModuleDef); +#else + (void)Py_InitModule("cPerf", cPerfMethods); +#endif +} #else // STANDALONE diff --git a/requirements.client.txt b/requirements.client.txt index f1fe89f..2d919b0 100644 --- a/requirements.client.txt +++ b/requirements.client.txt @@ -7,12 +7,10 @@ Jinja2==2.7.2 MarkupSafe==0.23 SQLAlchemy==1.1.11 Werkzeug==0.12.2 -argparse==1.3.0 itsdangerous==0.24 python-dateutil==2.6.0 python-gnupg==0.3.7 pytz==2016.10 -wsgiref==0.1.2 WTForms==2.0.2 Flask-WTF==0.12 typing @@ -9,6 +9,9 @@ from sys import platform as _platform import sys from setuptools import setup, find_packages, Extension +if sys.version_info < (2, 7): + raise RuntimeError("Python 2.7 or higher required.") + cflags = [] if _platform == "darwin": @@ -124,4 +127,6 @@ http://llvm.org/svn/llvm-project/lnt/trunk install_requires=reqs, ext_modules=[cPerf], + + python_requires='>=2.7', ) |