Repository: scipy/scipy

Issue:
need high, stop, pass options to signal.firwin (Trac #902)
_Original ticket http://projects.scipy.org/scipy/ticket/902 on 2009-03-26 by trac user tpk@..., assigned to unknown._

Feature requested on scipy-user maillist, here's a link to the thread on nabble:
  http://www.nabble.com/scipy.signal.firwin-td22587139.html

Excerpt in case that link ever dies:

I'm missing the functionality of firwin like in matlab/octave fir1, so that I 
can give a 'low', 'high' and 'stop' option. I don't know how to create a FIR 
window based high pass filter. Or is there something planned for the future? 



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -88,18 +88,7 @@ def _minimal_ext_cmd(cmd):
 # a lot more robust than what was previously being used.
 builtins.__SCIPY_SETUP__ = True
 
-def write_version_py(filename='scipy/version.py'):
-    cnt = """
-# THIS FILE IS GENERATED FROM SCIPY SETUP.PY
-short_version = '%(version)s'
-version = '%(version)s'
-full_version = '%(full_version)s'
-git_revision = '%(git_revision)s'
-release = %(isrelease)s
-
-if not release:
-    version = full_version
-"""
+def get_version_info():
     # Adding the git rev number needs to be done inside
     # write_version_py(), otherwise the import of scipy.version messes
     # up the build under Python 3.
@@ -108,13 +97,33 @@ def write_version_py(filename='scipy/version.py'):
         GIT_REVISION = git_version()
     elif os.path.exists('scipy/version.py'):
         # must be a source distribution, use existing version file
-        from scipy.version import git_revision as GIT_REVISION
+        # load it as a separate module to not load scipy/__init__.py
+        import imp
+        version = imp.load_source('scipy.version', 'scipy/version.py')
+        GIT_REVISION = version.git_revision
     else:
         GIT_REVISION = "Unknown"
 
     if not ISRELEASED:
         FULLVERSION += '.dev-' + GIT_REVISION[:7]
 
+    return FULLVERSION, GIT_REVISION
+
+
+def write_version_py(filename='scipy/version.py'):
+    cnt = """
+# THIS FILE IS GENERATED FROM SCIPY SETUP.PY
+short_version = '%(version)s'
+version = '%(version)s'
+full_version = '%(full_version)s'
+git_revision = '%(git_revision)s'
+release = %(isrelease)s
+
+if not release:
+    version = full_version
+"""
+    FULLVERSION, GIT_REVISION = get_version_info()
+
     a = open(filename, 'w')
     try:
         a.write(cnt % {'version': VERSION,
@@ -155,15 +164,11 @@ def configuration(parent_package='',top_path=None):
 
 
 def setup_package():
-    from numpy.distutils.core import setup
 
     # Rewrite the version file everytime
     write_version_py()
 
-    # Generate Cython sources
-    generate_cython()
-
-    setup(
+    META_DATA = dict(
         name = 'scipy',
         maintainer = "SciPy Developers",
         maintainer_email = "scipy-dev@scipy.org",
@@ -174,8 +179,27 @@ def setup_package():
         license = 'BSD',
         classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
         platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
-        configuration=configuration)
+    )
+
+    # For actins line egg_info and --version NumPy is not required
+    if '--help' in sys.argv[1:] or \
+      sys.argv[1] in ('--help-commands', 'egg_info', '--version'):
+        try:
+            from setuptools import setup
+        except ImportError:
+           from distutils.core import setup
+
+        FULLVERSION, GIT_REVISION = get_version_info()
+        META_DATA['version'] = FULLVERSION
+    else:
+        from numpy.distutils.core import setup
+
+        # Generate Cython sources
+        generate_cython()
+
+        META_DATA['configuration'] = configuration
 
+    setup(**META_DATA)
 
 if __name__ == '__main__':
     setup_package()


Test patch: