[LNT] r371943 - [LNT] Python 3 support: Set up (client) setup requirements
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 15 15:28:39 PDT 2019
Author: hubert.reinterpretcast
Date: Sun Sep 15 15:28:39 2019
New Revision: 371943
URL: http://llvm.org/viewvc/llvm-project?rev=371943&view=rev
Log:
[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
Modified:
lnt/trunk/lnt/testing/profile/cPerf.cpp
lnt/trunk/requirements.client.txt
lnt/trunk/setup.py
Modified: lnt/trunk/lnt/testing/profile/cPerf.cpp
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/profile/cPerf.cpp?rev=371943&r1=371942&r2=371943&view=diff
==============================================================================
--- lnt/trunk/lnt/testing/profile/cPerf.cpp (original)
+++ lnt/trunk/lnt/testing/profile/cPerf.cpp Sun Sep 15 15:28:39 2019
@@ -812,7 +812,25 @@ static PyMethodDef cPerfMethods[] = {{"i
"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
Modified: lnt/trunk/requirements.client.txt
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/requirements.client.txt?rev=371943&r1=371942&r2=371943&view=diff
==============================================================================
--- lnt/trunk/requirements.client.txt (original)
+++ lnt/trunk/requirements.client.txt Sun Sep 15 15:28:39 2019
@@ -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
Modified: lnt/trunk/setup.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/setup.py?rev=371943&r1=371942&r2=371943&view=diff
==============================================================================
--- lnt/trunk/setup.py (original)
+++ lnt/trunk/setup.py Sun Sep 15 15:28:39 2019
@@ -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/tru
install_requires=reqs,
ext_modules=[cPerf],
+
+ python_requires='>=2.7',
)
More information about the llvm-commits
mailing list