Skip to content
This repository

Generate package list automatically in find_packages #646

Merged
merged 1 commit into from over 2 years ago

2 participants

Min RK Fernando Perez
Min RK
Owner
minrk commented July 30, 2011

Previously, the package list was manually specified, which meant that it became out of date any time a package was added, and IPython would become uninstallable. This would not be noticed for some time by developers, who always use setupegg.py --develop or symlinks.

This update immediately revealed that IPython.zmq.tests and IPython.extensions.tests were never included in 0.11. Other than that, there is no difference in the package list.

Wait for after 0.11, in case of unforeseen side effects.

Min RK
Owner

@fperez is there any reason that we should not do it this way? The only one I see is that you can change what's installed by creating new files inside the IPython dir, but this doesn't strike me as anything but an improvement.

Fernando Perez
Owner

Nope, that's certainly the right way to do it. Merge away!

Min RK Generate package list automatically in find_packages
Previously, the package list was manually specified, which meant that
it became out of date any time a package was added, and IPython would
become uninstallable. This would not be noticed for some time by
developers, who always use `setupegg.py --develop` or symlinks.

This update immediately revealed that IPython.zmq.tests and IPython.extensions.tests were never included in 0.11.  Other than that, there is no difference in the package list.
1eea56b
Min RK minrk merged commit 1eea56b into from August 01, 2011
Min RK minrk closed this August 01, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 01, 2011
Min RK Generate package list automatically in find_packages
Previously, the package list was manually specified, which meant that
it became out of date any time a package was added, and IPython would
become uninstallable. This would not be noticed for some time by
developers, who always use `setupegg.py --develop` or symlinks.

This update immediately revealed that IPython.zmq.tests and IPython.extensions.tests were never included in 0.11.  Other than that, there is no difference in the package list.
1eea56b
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 11 additions and 48 deletions. Show diff stats Hide diff stats

  1. 59  setupbase.py
59  setupbase.py
@@ -82,58 +82,21 @@ def file_doesnt_endwith(test,endings):
82 82
 # Find packages
83 83
 #---------------------------------------------------------------------------
84 84
 
85  
-def add_package(packages,pname,config=False,tests=False,scripts=False,
86  
-                others=None):
87  
-    """
88  
-    Add a package to the list of packages, including certain subpackages.
89  
-    """
90  
-    packages.append('.'.join(['IPython',pname]))
91  
-    if config:
92  
-        packages.append('.'.join(['IPython',pname,'config']))
93  
-    if tests:
94  
-        packages.append('.'.join(['IPython',pname,'tests']))
95  
-    if scripts:
96  
-        packages.append('.'.join(['IPython',pname,'scripts']))
97  
-    if others is not None:
98  
-        for o in others:
99  
-            packages.append('.'.join(['IPython',pname,o]))
100  
-
101 85
 def find_packages():
102 86
     """
103 87
     Find all of IPython's packages.
104 88
     """
105  
-    packages = ['IPython']
106  
-    add_package(packages, 'config', tests=True, others=['profile'])
107  
-    add_package(packages, 'core', tests=True)
108  
-    add_package(packages, 'extensions')
109  
-    add_package(packages, 'external')
110  
-    add_package(packages, 'external.argparse')
111  
-    add_package(packages, 'external.decorator')
112  
-    add_package(packages, 'external.decorators')
113  
-    add_package(packages, 'external.guid')
114  
-    add_package(packages, 'external.Itpl')
115  
-    add_package(packages, 'external.mglob')
116  
-    add_package(packages, 'external.path')
117  
-    add_package(packages, 'external.pexpect')
118  
-    add_package(packages, 'external.pyparsing')
119  
-    add_package(packages, 'external.simplegeneric')
120  
-    add_package(packages, 'external.ssh')
121  
-    add_package(packages, 'kernel')
122  
-    add_package(packages, 'frontend')
123  
-    add_package(packages, 'frontend.qt')
124  
-    add_package(packages, 'frontend.qt.console', tests=True)
125  
-    add_package(packages, 'frontend.terminal', tests=True)    
126  
-    add_package(packages, 'lib', tests=True)
127  
-    add_package(packages, 'parallel', tests=True, scripts=True, 
128  
-                                    others=['apps','engine','client','controller'])
129  
-    add_package(packages, 'quarantine', tests=True)
130  
-    add_package(packages, 'scripts')
131  
-    add_package(packages, 'testing', tests=True)
132  
-    add_package(packages, 'testing.plugin', tests=False)
133  
-    add_package(packages, 'utils', tests=True)
134  
-    add_package(packages, 'zmq')
135  
-    add_package(packages, 'zmq.pylab')
136  
-    add_package(packages, 'zmq.gui')
  89
+    excludes = ['deathrow']
  90
+    packages = []
  91
+    for dir,subdirs,files in os.walk('IPython'):
  92
+        package = dir.replace(os.path.sep, '.')
  93
+        if any([ package.startswith('IPython.'+exc) for exc in excludes ]):
  94
+            # package is to be excluded (e.g. deathrow)
  95
+            continue
  96
+        if '__init__.py' not in files:
  97
+            # not a package
  98
+            continue
  99
+        packages.append(package)
137 100
     return packages
138 101
 
139 102
 #---------------------------------------------------------------------------
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.