Commits

catseye  committed 43fa178

Implement rectify_permissions hint.

  • Participants
  • Parent commits 0590b83

Comments (0)

Files changed (3)

File README.markdown

     executable on your executable search path; if you do not, it will display
     an error message, and will not try to dock the source.
     
-*   `rectify_permissions`
+*   `rectify_permissions`
     
     Example: `rectify_permissions yes`
 
-    means rectify the execute permissions; after checking out the given
-    source but before building it, traverse all of the files in the source
-    tree, run `file` on each one, and set its executable permission based on
-    whether `file` called it `executable` or not.  (This is the default for
-    `.zip` archives.)
+    Either `yes` or `no`.  If `yes`, rectify the execute permissions of the
+    source, which means: after checking out the source but before building
+    it, traverse all of the files in the source tree, run `file` on each one,
+    and set its executable permission based on whether `file` called it
+    `executable` or not.  This defaults to `no` for all sources except for
+    `.zip` archives, for which it defaults to `yes`; this hint will override
+    the default.
     
 *   ♦ `prerequisites`
     

File cookies.catalog

 
 bb:catseye/yucca
   require_executables python
+
+http://catseye.tc/dieter-1.0-2011.1214.zip
+  rectify_permissions no

File toolshelf.py

     'exclude_paths',
     'only_paths',
     #'prerequisites',
+    'rectify_permissions',
     'require_executables',
 )
 
                             (hint_name, hint_value, spec_key)
                         )
                         self._hint_map[spec_key][hint_name] = hint_value
+                        if (hint_name == 'rectify_permissions' and
+                            hint_value not in ('yes', 'no')):
+                            raise ValueError(
+                                "rectify_permissions must be 'yes' or 'no'"
+                            )
                         found_hint = True
                         break
                 if found_hint or line == '' or line.startswith('#'):
                 extracted_dir = extract_dir
             run('mv', extracted_dir, self.dir)
             run('rm', '-rf', extract_dir)
-
-            if self.type == 'zip':
-                self.rectify_executable_permissions()
         else:
             raise NotImplementedError(self.type)
+        
+        rectify_permissions = 'no'
+        if self.type == 'zip':
+            rectify_permissions = 'yes'
+        rectify_permissions = self.hints.get(
+            'rectify_permissions', rectify_permissions
+        )
+        if rectify_permissions not in ('yes', 'no'):
+            raise ValueError(
+                "rectify_permissions should be 'yes' or 'no'"
+            )
+        if rectify_permissions == 'yes':
+            self.rectify_executable_permissions()
 
     def build(self):
         if not OPTIONS.build: