Title: [170706] trunk/Tools
Revision
170706
Author
[email protected]
Date
2014-07-02 08:13:33 -0700 (Wed, 02 Jul 2014)

Log Message

[GTK] Make dist only works when run from the source directory
https://bugs.webkit.org/show_bug.cgi?id=134543

Reviewed by Martin Robinson.

Since the paths in the manifest are relative to the source dir,
and the script expects the current working directory to be the
source directory, resolve all passed in relative paths while
parsing the arguments and then change the current working
directory.

* gtk/make-dist.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (170705 => 170706)


--- trunk/Tools/ChangeLog	2014-07-02 15:11:41 UTC (rev 170705)
+++ trunk/Tools/ChangeLog	2014-07-02 15:13:33 UTC (rev 170706)
@@ -1,5 +1,20 @@
 2014-07-02  Carlos Garcia Campos  <[email protected]>
 
+        [GTK] Make dist only works when run from the source directory
+        https://bugs.webkit.org/show_bug.cgi?id=134543
+
+        Reviewed by Martin Robinson.
+
+        Since the paths in the manifest are relative to the source dir,
+        and the script expects the current working directory to be the
+        source directory, resolve all passed in relative paths while
+        parsing the arguments and then change the current working
+        directory.
+
+        * gtk/make-dist.py:
+
+2014-07-02  Carlos Garcia Campos  <[email protected]>
+
         [GTK] make dist is broken
         https://bugs.webkit.org/show_bug.cgi?id=134542
 

Modified: trunk/Tools/gtk/make-dist.py (170705 => 170706)


--- trunk/Tools/gtk/make-dist.py	2014-07-02 15:11:41 UTC (rev 170705)
+++ trunk/Tools/gtk/make-dist.py	2014-07-02 15:13:33 UTC (rev 170706)
@@ -116,8 +116,8 @@
         self.current_directory = None
         self.directories = []
         self.tarball_root = tarball_root
-        self.source_root = os.path.abspath(source_root)
-        self.build_root = os.path.abspath(build_root)
+        self.source_root = source_root
+        self.build_root = build_root
 
         # Normalize the tarball root so that it starts and ends with a slash.
         if not self.tarball_root.endswith('/'):
@@ -204,20 +204,29 @@
 
 
 if __name__ == "__main__":
+    class FilePathAction(argparse.Action):
+        def __call__(self, parser, namespace, values, option_string=None):
+            setattr(namespace, self.dest, os.path.abspath(values))
+
     parser = argparse.ArgumentParser(description='Build a distribution bundle.')
-    parser.add_argument('-s', '--source-dir', type=str, default=os.getcwd(),
+    parser.add_argument('-s', '--source-dir', type=str, action="" default=os.getcwd(),
                         help='The top-level directory of the source distribution. ' + \
                               'Directory for relative paths. Defaults to current directory.')
     parser.add_argument('--tarball-root', type=str, default='/',
                         help='The top-level path of the tarball. By default files are added to the root of the tarball.')
-    parser.add_argument('-b', '--build-dir', type=str, default=None,
+    parser.add_argument('-b', '--build-dir', type=str, action="" default=None,
                         help='The top-level path of directory of the build root. ' + \
                               'By default there is no build root.')
-    parser.add_argument('-o', type=str, default='out.tar', dest="output_filename",
+    parser.add_argument('-o', type=str, action="" default='out.tar', dest="output_filename",
                         help='The tarfile to produce. By default this is "out.tar"')
-    parser.add_argument('manifest_filename', metavar="manifest", type=str, help='The path to the manifest file.')
+    parser.add_argument('manifest_filename', metavar="manifest", type=str, action="" help='The path to the manifest file.')
 
     arguments = parser.parse_args()
 
+    # Paths in the manifest are relative to the source directory, and this script assumes that
+    # current working directory is the source directory, so change the current working directory
+    # to be the source directory.
+    os.chdir(arguments.source_dir)
+
     manifest = Manifest(arguments.manifest_filename, arguments.source_dir, arguments.build_dir, arguments.tarball_root)
     manifest.create_tarfile(arguments.output_filename)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to