Permalink
Browse files

Makes devlib usable outside of the test suite

  • Loading branch information...
kumar303 committed Oct 2, 2011
1 parent 881dd3c commit 51cc27940344d804094641de58530350521e9850
Showing with 21 additions and 12 deletions.
  1. +18 −0 devlib.py
  2. BIN devlib/Pygments-1.4.zip
  3. BIN devlib/Sphinx-1.0.8.zip
  4. +3 −12 manage.py
View
@@ -0,0 +1,18 @@
+import glob
+import os
+import sys
+
+
+def activate():
+ """Adds sys.paths for all zipped Python modules in the devlib dir.
+
+ NOTE: this is intended for local development and testing, not
+ for use on App Engine.
+ """
+ devlib = os.path.join(os.path.dirname(__file__), 'devlib')
+ if not os.path.exists(devlib):
+ raise EnvironmentError("Expected lib dir to exist: %r" % devlib)
+ for path in glob.glob(devlib+'/*.zip'):
+ mod = os.path.splitext(os.path.basename(path))[0]
+ # e.g. /path/to/fudge-0.9.4.zip/fudge-0.9.4
+ sys.path.append(os.path.join(path, mod))
View
Binary file not shown.
View
Binary file not shown.
View
@@ -12,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
+import sys
# WARNING: This script is not run in production.
# See main.py for that.
@@ -24,24 +24,15 @@
try:
import settings # Assumed to be in the same directory.
except ImportError:
- import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
if __name__ == "__main__":
# chirp: hack to enable devlib.
- import glob
- import sys
- import os
if 'test' in sys.argv:
- devlib = os.path.join(os.path.dirname(__file__), 'devlib')
- if not os.path.exists(devlib):
- raise EnvironmentError("Expected lib dir to exist: %r" % devlib)
- for path in glob.glob(devlib+'/*.zip'):
- mod = os.path.splitext(os.path.basename(path))[0]
- # e.g. /path/to/fudge-0.9.4.zip/fudge-0.9.4
- sys.path.append(os.path.join(path, mod))
+ import devlib
+ devlib.activate()
execute_manager(settings)

0 comments on commit 51cc279

Please sign in to comment.