Commits

Anonymous committed 135396b

Command to rectify executable permissions. factor cookie.

Comments (0)

Files changed (2)

 
 gh:paulhodge/circa
   exclude_paths platform tests
+
+git://factorcode.org/git/factor.git
+  exclude_paths basis extra unmaintained
             run('rm', '-rf', extract_dir)
         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:
                     if 'executable' in output:
                         make_it_executable = True
                     if make_it_executable:
-                        note("Making %s executable" % name)
+                        note("Making %s executable" % os.path.join(dirname, name))
                         subprocess.check_call(["chmod", "u+x", filename])
                     else:
-                        note("Making %s NON-executable" % name)
+                        note("Making %s NON-executable" % os.path.join(dirname, name))
                         subprocess.check_call(["chmod", "u-x", filename])
 
         traverse(self.dir)
 
+    def rectify_permissions_if_needed(self):
+        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()
+
 
 ### Helper
 
                             (source.name, executable)
                         )
             source.checkout()
+            source.rectify_permissions_if_needed()
             source.build()
     foreach_source(result, args, dock)
 
                     for filename in sorted(os.listdir(component)):
                         if is_executable(os.path.join(component, filename)):
                             print "  %s" % filename
+    elif args[0] == 'rectify':
+        specs = expand_docked_specs(args[1:], default_all=True)
+        sources = Source.from_specs(specs)
+        p = Path()
+        for component in p.components:
+            for source in sources:
+                  source.rectify_permissions_if_needed()
+                  path_cmd(result, ['rebuild', source.name])
     else:
         raise CommandLineSyntaxError(
             "Unrecognized 'path' subcommand '%s'\n" % args[0]