Skip to content

Commit ab0d353

Browse files
committed
On ReadTheDocs, build with -O0
1 parent 50d02f3 commit ab0d353

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

readthedocs-conda.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ channels:
22
- conda-forge
33
dependencies:
44
- pari
5+
- sphinx
6+
- cython
7+
- cysignals

requirements.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

setup.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,6 @@
33
import os
44
import sys
55

6-
if "READTHEDOCS" in os.environ:
7-
# When building with readthedocs, install the dependencies too.
8-
# See https://github.com/rtfd/readthedocs.org/issues/2776
9-
for reqs in ["requirements.txt"]:
10-
if os.path.isfile(reqs):
11-
from subprocess import check_call
12-
check_call([sys.executable, "-m", "pip", "install", "-r", reqs])
13-
14-
# Print PARI/GP defaults and environment variables for debugging
15-
from subprocess import Popen, PIPE
16-
Popen(["gp", "-f", "-q"], stdin=PIPE).communicate(b"default()")
17-
for item in os.environ.items():
18-
print("%s=%r" % item)
19-
20-
216
from setuptools import setup
227
from distutils.command.build_ext import build_ext as _build_ext
238
from setuptools.command.bdist_egg import bdist_egg as _bdist_egg
@@ -26,6 +11,20 @@
2611
from autogen import rebuild
2712
from autogen.paths import include_dirs, library_dirs
2813

14+
ext_kwds = dict(include_dirs=include_dirs(), library_dirs=library_dirs())
15+
16+
17+
if "READTHEDOCS" in os.environ:
18+
# When building with readthedocs, disable optimizations to decrease
19+
# resource usage during build
20+
ext_kwds["extra_compile_args"] = ["-O0"]
21+
22+
# Print PARI/GP defaults and environment variables for debugging
23+
from subprocess import Popen, PIPE
24+
Popen(["gp", "-f", "-q"], stdin=PIPE).communicate(b"default()")
25+
for item in os.environ.items():
26+
print("%s=%r" % item)
27+
2928

3029
# Adapted from Cython's new_build_ext
3130
class build_ext(_build_ext):
@@ -76,8 +75,7 @@ def run(self):
7675
author="Luca De Feo, Vincent Delecroix, Jeroen Demeyer, Vincent Klein",
7776
author_email="[email protected]",
7877
license='GNU General Public License, version 2 or later',
79-
ext_modules=[Extension("*", ["cypari2/*.pyx"],
80-
include_dirs=include_dirs(), library_dirs=library_dirs())],
78+
ext_modules=[Extension("*", ["cypari2/*.pyx"], **ext_kwds)],
8179
keywords='PARI/GP number theory',
8280
packages=['cypari2'],
8381
package_dir={'cypari2': 'cypari2'},

0 commit comments

Comments
 (0)