[Checkins] SVN: bluebream/trunk/src/bluebream/bluebream_base/ Add a message after template creation

Christophe Combelles ccomb at free.fr
Sat Apr 10 15:02:47 EDT 2010


Log message for revision 110717:
  Add a message after template creation
  Removed the egg-info directory
  

Changed:
  D   bluebream/trunk/src/bluebream/bluebream_base/project_template/src/+project+.egg-info/
  U   bluebream/trunk/src/bluebream/bluebream_base/template.py
  U   bluebream/trunk/src/bluebream/bluebream_base/tests/bluebream.txt

-=-
Modified: bluebream/trunk/src/bluebream/bluebream_base/template.py
===================================================================
--- bluebream/trunk/src/bluebream/bluebream_base/template.py	2010-04-10 18:53:15 UTC (rev 110716)
+++ bluebream/trunk/src/bluebream/bluebream_base/template.py	2010-04-10 19:02:47 UTC (rev 110717)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-import re, os, sys
+import re, os, sys, shutil
 import pkg_resources
 from paste.script import templates
 from paste.script.templates import var
@@ -86,29 +86,34 @@
     def post(self, command, output_dir, vars):
         """Add namespace packages and move the main package to the last level
         """
-        # do nothing if there is no namespace
-        if len(self.ns_split) == 1:
-            return
+        # if we have a namespace package
+        if len(self.ns_split) > 1:
+            package_dir = os.path.join(output_dir, 'src', vars['package'])
+            tmp_dir = package_dir + '.tmp'
+            os.rename(package_dir, tmp_dir)
 
-        package_dir = os.path.join(output_dir, 'src', vars['package'])
-        tmp_dir = package_dir + '.tmp'
-        os.rename(package_dir, tmp_dir)
+            # create the intermediate namespace packages
+            target_dir = os.path.join(output_dir, 'src',
+                                      os.path.join(*self.ns_split[:-1]))
+            os.makedirs(target_dir)
 
-        # create the intermediate namespace packages
-        target_dir = os.path.join(output_dir, 'src',
-                                  os.path.join(*self.ns_split[:-1]))
-        os.makedirs(target_dir)
+            # create each __init__.py with namespace declaration
+            ns_decl = "__import__('pkg_resources').declare_namespace(__name__)"
+            for i, namespace_package in enumerate(self.ns_split[:-1]):
+                init_file = os.path.join(output_dir, 'src',
+                                         os.path.join(*self.ns_split[:i+1]),
+                                         '__init__.py')
+                open(init_file, 'w').write(ns_decl)
 
-        # create each __init__.py with namespace declaration
-        ns_decl = "__import__('pkg_resources').declare_namespace(__name__)"
-        for i, namespace_package in enumerate(self.ns_split[:-1]):
-            init_file = os.path.join(output_dir, 'src',
-                                     os.path.join(*self.ns_split[:i+1]),
-                                     '__init__.py')
-            open(init_file, 'w').write(ns_decl)
+            # move the (renamed) main package to the last namespace
+            os.rename(tmp_dir,
+                      os.path.join(target_dir, os.path.basename(package_dir,)))
 
-        # move the (renamed) main package to the last namespace
-        os.rename(tmp_dir,
-                  os.path.join(target_dir, os.path.basename(package_dir,)))
+        print("\nYour project has been created! Now, you want to:\n"
+              "1) put the generated files under version control\n"
+              "2) run: python boostrap.py "
+              "3) run: ./bin/buildout\n"
+             )
 
 
+

Modified: bluebream/trunk/src/bluebream/bluebream_base/tests/bluebream.txt
===================================================================
--- bluebream/trunk/src/bluebream/bluebream_base/tests/bluebream.txt	2010-04-10 18:53:15 UTC (rev 110716)
+++ bluebream/trunk/src/bluebream/bluebream_base/tests/bluebream.txt	2010-04-10 19:02:47 UTC (rev 110717)
@@ -55,7 +55,11 @@
   zip_safe:          False
 Creating template bluebream
 Creating directory ./sample
+<BLANKLINE>
+Your project has been created! Now, you want to:
+...
 
+
 >>> print_dir('sample')
 sample/bootstrap.py
 sample/buildout.cfg
@@ -124,6 +128,9 @@
   zip_safe:          False
 Creating template bluebream
 Creating directory ./sample.main
+<BLANKLINE>
+Your project has been created! Now, you want to:
+...
 
 >>> print_dir('sample.main')
 sample.main/bootstrap.py
@@ -200,6 +207,9 @@
   zip_safe:          False
 Creating template bluebream
 Creating directory ./sample.app.main
+<BLANKLINE>
+Your project has been created! Now, you want to:
+...
 
 >>> print_dir('sample.app.main')
 sample.app.main/bootstrap.py
@@ -276,6 +286,9 @@
   zip_safe:          False
 Creating template bluebream
 Creating directory ./foobar.foobar
+<BLANKLINE>
+Your project has been created! Now, you want to:
+...
 
 >>> print_dir('foobar.foobar')
 foobar.foobar/bootstrap.py
@@ -349,6 +362,9 @@
   zip_safe:          False
 Creating template bluebream
 Creating directory ./sampleproject
+<BLANKLINE>
+Your project has been created! Now, you want to:
+...
 
 >>> print_dir('sampleproject')
 sampleproject/bootstrap.py



More information about the checkins mailing list