Commits

Anonymous committed 51884ae

pushing cfgs to etc

  • Participants
  • Parent commits a3ac048

Comments (0)

Files changed (1)

z3c/recipe/debian/__init__.py

                  ])
 
         application_name = self.options['application_name'].lower()
-        etc_dir = ''
         buildout_dir = self.buildout['buildout']['directory']
 
         for source, default in DEFAULT_PATHS.items():
             source_dir = os.path.join(buildout_dir, source)
             if not os.path.exists(source_dir):
                 continue
-            if source == 'etc':
-                etc_dir = source_dir
             # copying the tree now
             target = os.path.join(debian_root, 'debian',
                                   'buildout-%s' % application_name, target)
 
         # operating files are located in etc
         etc_dir = paths.get('etc', DEFAULT_PATHS['etc'])
+        if etc_dir.startswith('/'):
+            etc_dir = default[1:]
 
         for path in os.listdir(buildout_dir):
             fullpath = os.path.join(buildout_dir, path)
                 continue
             target = os.path.join(debian_root, 'debian',
                                   'buildout-%s' % application_name,
-                                  path)
+                                  etc_dir, path)
+            if '%(app)s' in target:
+                target = target % {'app': application_name}
+            uptarget = os.path.split(target)[0]
+            if not os.path.exists(uptarget):
+                os.makedirs(uptarget)
 
-            self._log('Copying %s to %s' % (path, target))
-            shutil.copyfile(path, target)
+            self._log('Copying %s to %s' % (fullpath, target))
+            shutil.copyfile(fullpath, target)
 
         vars = {'application_name': application_name}
         cmd = Command('run_debian')