[PATCH] install bin/test and bin/py.bench with "./setup.py sdist"

1 view
Skip to first unread message

Ondrej Certik

unread,
Nov 18, 2008, 9:14:11 AM11/18/08
to sympy-...@googlegroups.com, Ondrej Certik
But do not install them with "./setup.py install". This is important, because
we don't want "test" and "py.bench" to end up in /usr/bin/.
---
MANIFEST.in | 2 ++
setup.py | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index 1908989..6a922b7 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -8,3 +8,5 @@ include sympy/utilities/mathml/data/*.xsl

include LICENSE
include TODO
+include bin/test
+include bin/py.bench
diff --git a/setup.py b/setup.py
index a8eb022..813ea37 100755
--- a/setup.py
+++ b/setup.py
@@ -314,7 +314,7 @@ setup(
url = 'http://code.google.com/p/sympy',
packages = ['sympy'] + [ m[1] for m in modules ] + tests + \
pyglet_packages,
- scripts = ['bin/isympy', 'bin/py.bench'],
+ scripts = ['bin/isympy'],
ext_modules = [],
package_data = { 'sympy.utilities.mathml' : ['data/*.xsl'] },
data_files = [('share/man/man1', ['doc/man/isympy.1'])],
--
1.5.6.5

Ondrej Certik

unread,
Nov 18, 2008, 9:14:12 AM11/18/08
to sympy-...@googlegroups.com, Ondrej Certik
Previously, the examples directory was checked for code style. However, when
the user installs sympy using "./setup.py install", the examples are not
installed (at least not in the parent directory of "sympy"), so the result is
that sympy.test() fails.

Now we only check the examples dir if it's present.
---
sympy/utilities/tests/test_code_quality.py | 45 ++++++++++++++++-----------
1 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/sympy/utilities/tests/test_code_quality.py b/sympy/utilities/tests/test_code_quality.py
index 66accf7..b2f2e91 100644
--- a/sympy/utilities/tests/test_code_quality.py
+++ b/sympy/utilities/tests/test_code_quality.py
@@ -59,11 +59,27 @@ def test_no_trailing_whitespace_and_no_tabs():
path = split(__file__)[0]
path = path + sep + pardir + sep + pardir # go to sympy/
sympy_path = abspath(path)
+ assert exists(sympy_path)
+ check_directory_tree(sympy_path)
examples_path = abspath(join(path + sep + pardir, "examples"))
- paths = (sympy_path, examples_path)
- for p in paths:
- assert exists(p)
- check_directory_tree(p)
+ # Remember that this test can be executed when examples are not installed
+ # (e.g. after "./setup.py install"), so don't raise an error if the
+ # examples are not found:
+ if exists(examples_path):
+ check_directory_tree(examples_path)
+
+def check_directory_tree_imports(p, exclude):
+ for root, dirs, files in walk(p):
+ for fname in glob(join(root, "*.py")):
+ if filter(lambda ex: ex in fname, exclude):
+ continue
+ file = open(fname, "r")
+ try:
+ for idx, line in enumerate(file):
+ if re.match("^\s*from.*import.*\*",line):
+ assert False, message_implicit % (fname, idx+1)
+ finally:
+ file.close()

def test_implicit_imports():
"""
@@ -73,7 +89,6 @@ def test_implicit_imports():
path = path + sep + pardir + sep + pardir # go to sympy/
sympy_path = abspath(path)
examples_path = abspath(join(path + sep + pardir, "examples"))
- paths = (sympy_path, examples_path)
exclude = set([
"%(sep)sthirdparty%(sep)s" % sepd,
"%(sep)s__init__.py" % sepd,
@@ -81,16 +96,10 @@ def test_implicit_imports():
"%(sep)smpmath%(sep)s" % sepd,
"%(sep)splotting%(sep)s" % sepd,
])
- for p in paths:
- assert exists(p)
- for root, dirs, files in walk(p):
- for fname in glob(join(root, "*.py")):
- if filter(lambda ex: ex in fname, exclude):
- continue
- file = open(fname, "r")
- try:
- for idx, line in enumerate(file):
- if re.match("^\s*from.*import.*\*",line):
- assert False, message_implicit % (fname, idx+1)
- finally:
- file.close()
+ assert exists(sympy_path)
+ check_directory_tree_imports(sympy_path, exclude)
+ # Remember that this test can be executed when examples are not installed
+ # (e.g. after "./setup.py install"), so don't raise an error if the
+ # examples are not found:
+ if exists(examples_path):
+ check_directory_tree_imports(examples_path, exclude)
--
1.5.6.5

Ondrej Certik

unread,
Nov 18, 2008, 9:26:26 AM11/18/08
to sympy-...@googlegroups.com


Are there any objections? I want to push this in asap and release beta2.

Ondrej

Vinzent Steinberg

unread,
Nov 18, 2008, 10:14:18 AM11/18/08
to sympy-patches
+1

Vinzent
Reply all
Reply to author
Forward
0 new messages