Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: setup.py cleanups and additions #454

Merged
merged 10 commits into from Mar 24, 2013
11 changes: 10 additions & 1 deletion INSTALL.txt
Expand Up @@ -36,6 +36,10 @@ __ http://www.python.org

__ http://www.numpy.org/

3) If you want to build the documentation: Sphinx__ 1.1.0 or newer

__ http://http://sphinx-doc.org/

Windows
-------

Expand Down Expand Up @@ -133,7 +137,12 @@ $HOME/lib/python2.4/site-packages/scipy). Then type::
git clean -xdf
python setup.py install


Documentation
-------------
Type::

cd scipy
python setup.py build_sphinx

INSTALLATION
============
Expand Down
48 changes: 15 additions & 33 deletions MANIFEST.in
@@ -1,38 +1,20 @@
# Use .add_data_files and .add_data_dir methods in a appropriate
# setup.py files to include non-python files such as documentation,
# data, etc files to distribution. Avoid using MANIFEST.in for that.
#
include MANIFEST.in
include *.txt
include setupscons.py
include setupegg.py
include setup.py
include scipy/*.py
# Cython generation
include cythonize.dat
include tools/cythonize.py
include scipy/cluster/_vq_rewrite.c # unused, but ship still
# Add Cython files
recursive-include scipy *.pyx *.pyx.in *.pxd *.pxi
# Add swig files
recursive-include scipy *.i
# Adding scons build related files not found by distutils
recursive-include scipy SConstruct SConscript
recursive-include scipy README
# Add files to allow Bento build
include f2py.py
include interface_gen.py
include bscript bento.info
recursive-include scipy bscript bento.info
# Top-level build scripts
include setup.py setupscons.py bscript bento.info
# All source files
recursive-include scipy *
# All documentation
recursive-include doc *
# Add build and testing tools
include tools/py3tool.py
include tox.ini
include tools/test-installed-scipy.py
# Add documentation: we don't use add_data_dir since we do not want to include
# this at installation, only for sdist-generated tarballs
include doc/Makefile doc/postprocess.py
recursive-include doc/release *
recursive-include doc/source *
recursive-include doc/sphinxext *
recursive-include tools *
# Cached Cython signatures
include cythonize.dat
# Exclude what we don't want to include
prune scipy/special/tests/data/boost
include scipy/special/Faddeeva.hh
prune scipy/special/tests/data/gsl
prune doc/build
prune doc/source/generated
prune */__pycache__
global-exclude *.pyc *~ *.bak
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to add *.swp (Vim tempfiles) and *.pyo here

5 changes: 3 additions & 2 deletions bscript
Expand Up @@ -125,10 +125,11 @@ def _set_mangling_var(conf, u, du, case, f2pycompat=True):
env.DEFINES.extend(macros)

def _generate_cython():
cwd = os.path.dirname(__file__)
cwd = os.path.abspath(os.path.dirname(__file__))
subprocess.call([sys.executable,
os.path.join(cwd, 'tools', 'cythonize.py'),
os.path.join(cwd, 'scipy')])
'scipy'],
cwd=cwd)

@hooks.post_configure
def post_configure(context):
Expand Down
21 changes: 15 additions & 6 deletions doc/README.txt
@@ -1,12 +1,21 @@
SciPy Reference Guide
=====================
SciPy Documentation
===================

Instructions
------------
How to build it
---------------
The easy way to build the documentation is to run

python setup.py build_sphinx

This will make first build Scipy in-place, and then generate documentation for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, remove "make"

it.

Another way
-----------
1. Optionally download an XML dump of the newest docstrings from the doc wiki
at ``/pydocweb/dump`` and save it as ``dump.xml``.
2. Run ``make html`` or ``make dist``

You can also run ``summarize.py`` to see which parts of the Numpy
namespace are documented.
Note that ``make html`` builds the documentation for the currently installed
version of Scipy, not the one corresponding to the source code here.

36 changes: 29 additions & 7 deletions setup.py
Expand Up @@ -133,12 +133,27 @@ def write_version_py(filename='scipy/version.py'):
finally:
a.close()

try:
from sphinx.setup_command import BuildDoc
HAVE_SPHINX = True
except ImportError:
HAVE_SPHINX = False

if HAVE_SPHINX:
class ScipyBuildDoc(BuildDoc):
"""Run in-place build before Sphinx doc build"""
def run(self):
ret = subprocess.call([sys.executable, sys.argv[0], 'build_ext', '-i'])
if ret != 0:
raise RuntimeError("Building Scipy failed!")
BuildDoc.run(self)

def generate_cython():
cwd = os.path.dirname(__file__)
cwd = os.path.abspath(os.path.dirname(__file__))
p = subprocess.Popen([sys.executable,
os.path.join(cwd, 'tools', 'cythonize.py'),
os.path.join(cwd, 'scipy')],
'scipy'],
cwd=cwd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
out, err = p.communicate()
Expand All @@ -162,12 +177,20 @@ def configuration(parent_package='',top_path=None):

return config


def setup_package():
try:
import setuptools
except ImportError:
pass

# Rewrite the version file everytime
write_version_py()

if HAVE_SPHINX:
cmdclass = {'build_sphinx': ScipyBuildDoc}
else:
cmdclass = {}

metadata = dict(
name = 'scipy',
maintainer = "SciPy Developers",
Expand All @@ -177,8 +200,10 @@ def setup_package():
url = "http://www.scipy.org",
download_url = "http://sourceforge.net/project/showfiles.php?group_id=27747&package_id=19531",
license = 'BSD',
cmdclass=cmdclass,
classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
test_suite='nose.collector',
)

if len(sys.argv) >= 2 and ('--help' in sys.argv[1:] or
Expand All @@ -188,10 +213,7 @@ def setup_package():
# They are required to succeed without Numpy for example when
# pip is used to install Scipy when Numpy is not yet present in
# the system.
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from distutils.core import setup

FULLVERSION, GIT_REVISION = get_version_info()
metadata['version'] = FULLVERSION
Expand Down
7 changes: 0 additions & 7 deletions setupegg.py

This file was deleted.

7 changes: 0 additions & 7 deletions setupeggscons.py

This file was deleted.

7 changes: 0 additions & 7 deletions setupsconsegg.py

This file was deleted.