Documentation at https://wikitech.wikimedia.org/wiki/Help:Toolforge/Database#Python updated to remove recommendation of using oursql, added a note about compilation problems, and link to this task. I also added a FAQ for the migration from Trusty to Stretch at https://wikitech.wikimedia.org/wiki/News/Toolforge_Trusty_deprecation#Python_'oursql'_package_fails_to_compile.
---
While migrating **spbot** to the Stretch job grid I ran into a problem while installing [[ https://pythonhosted.org/oursql/ | oursql ]] with pip (for python 2.7).
```lines=10
.-(~)-------------------------------------------------------------(tools.spbot@tools-sgebastion-06)-
`--> virtualenv venv
Running virtualenv with interpreter /usr/bin/python2
New python executable in /mnt/nfs/labstore-secondary-tools-project/spbot/venv/bin/python2
Also creating executable in /mnt/nfs/labstore-secondary-tools-project/spbot/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
.-(~)-------------------------------------------------------------(tools.spbot@tools-sgebastion-06)-
`--> source venv/bin/activate
.-(~)-------------------------------------------------------------(tools.spbot@tools-sgebastion-06)-
`--> pip install --upgrade pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already up-to-date: pip in ./venv/lib/python2.7/site-packages (19.0.2)
.-(~)-------------------------------------------------------------(tools.spbot@tools-sgebastion-06)-
`--> pip install oursql
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting oursql
Using cached https://files.pythonhosted.org/packages/8c/88/9f53a314a2af6f56c0a1249c5673ee384b85dc791bac5c1228772ced3502/oursql-0.9.3.2.tar.gz
Building wheels for collected packages: oursql
Building wheel for oursql (setup.py) ... error
Complete output from command /mnt/nfs/labstore-secondary-tools-project/spbot/venv/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-reczzD/oursql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-73iHZ5 --python-tag cp27:
cython not found, using previously-cython'd .c file.
running bdist_wheel
running build
running build_ext
building 'oursql' extension
mysql_config --cflags
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/oursqlx
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/oursql.c -o build/temp.linux-x86_64-2.7/oursqlx/oursql.o -I/usr/include/mysql
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/compat.c -o build/temp.linux-x86_64-2.7/oursqlx/compat.o -I/usr/include/mysql
In file included from oursqlx/compat.c:55:0:
oursqlx/_exceptions.c: In function ‘_oursqlx_exc_from_errno’:
oursqlx/_exceptions.c:621:50: error: ‘errmsg_section_start’ undeclared (first use in this function)
for(unsigned int i = 0; i < sizeof(errmsg_section_start)/sizeof(int); ++i) {
^~~~~~~~~~~~~~~~~~~~
oursqlx/_exceptions.c:621:50: note: each undeclared identifier is reported only once for each function it appears in
oursqlx/_exceptions.c:623:53: error: ‘errmsg_section_size’ undeclared (first use in this function)
int max = errmsg_section_start[i] + errmsg_section_size[i] - 1;
^~~~~~~~~~~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for oursql
Running setup.py clean for oursql
Failed to build oursql
Installing collected packages: oursql
Running setup.py install for oursql ... error
Complete output from command /mnt/nfs/labstore-secondary-tools-project/spbot/venv/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-reczzD/oursql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-lOJZZC/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/nfs/labstore-secondary-tools-project/spbot/venv/include/site/python2.7/oursql:
cython not found, using previously-cython'd .c file.
running install
running build
running build_ext
building 'oursql' extension
mysql_config --cflags
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/oursqlx
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/oursql.c -o build/temp.linux-x86_64-2.7/oursqlx/oursql.o -I/usr/include/mysql
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/compat.c -o build/temp.linux-x86_64-2.7/oursqlx/compat.o -I/usr/include/mysql
In file included from oursqlx/compat.c:55:0:
oursqlx/_exceptions.c: In function ‘_oursqlx_exc_from_errno’:
oursqlx/_exceptions.c:621:50: error: ‘errmsg_section_start’ undeclared (first use in this function)
for(unsigned int i = 0; i < sizeof(errmsg_section_start)/sizeof(int); ++i) {
^~~~~~~~~~~~~~~~~~~~
oursqlx/_exceptions.c:621:50: note: each undeclared identifier is reported only once for each function it appears in
oursqlx/_exceptions.c:623:53: error: ‘errmsg_section_size’ undeclared (first use in this function)
int max = errmsg_section_start[i] + errmsg_section_size[i] - 1;
^~~~~~~~~~~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/mnt/nfs/labstore-secondary-tools-project/spbot/venv/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-reczzD/oursql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-lOJZZC/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/nfs/labstore-secondary-tools-project/spbot/venv/include/site/python2.7/oursql" failed with error code 1 in /tmp/pip-install-reczzD/oursql/
```
Sorry for the full stack trace, but I'm not really familiar with venv and only following [[ https://wikitech.wikimedia.org/wiki/News/Toolforge_Trusty_deprecation#Rebuild_virtualenv_for_python_users | these steps ]].