Patchwork [2/4] qapi-types.py: Don't build paths by hand

login
register
mail settings
Submitter Luiz Capitulino
Date Oct. 17, 2011, 3:29 p.m.
Message ID <1318865377-3328-3-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/120236/
State New
Headers show

Comments

Luiz Capitulino - Oct. 17, 2011, 3:29 p.m.
Use os.path.join() instead.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 scripts/qapi-types.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Michael Roth - Oct. 17, 2011, 9:20 p.m.
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>

On Mon, 17 Oct 2011 13:29:35 -0200, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> Use os.path.join() instead.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  scripts/qapi-types.py |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
> index 986ff1e..8df4b72 100644
> --- a/scripts/qapi-types.py
> +++ b/scripts/qapi-types.py
> @@ -177,10 +177,10 @@ if __name__ == '__main__':
>          if o in ("-p", "--prefix"):
>              prefix = a
>          elif o in ("-o", "--output-dir"):
> -            output_dir = a + "/"
> +            output_dir = a
>      
> -    c_file = output_dir + prefix + c_file
> -    h_file = output_dir + prefix + h_file
> +    c_file = os.path.join(output_dir, prefix + c_file)
> +    h_file = os.path.join(output_dir, prefix + h_file)
>      
>      try:
>          os.makedirs(output_dir)
> -- 
> 1.7.7.rc3
>

Patch

diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index 986ff1e..8df4b72 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -177,10 +177,10 @@  if __name__ == '__main__':
         if o in ("-p", "--prefix"):
             prefix = a
         elif o in ("-o", "--output-dir"):
-            output_dir = a + "/"
+            output_dir = a
     
-    c_file = output_dir + prefix + c_file
-    h_file = output_dir + prefix + h_file
+    c_file = os.path.join(output_dir, prefix + c_file)
+    h_file = os.path.join(output_dir, prefix + h_file)
     
     try:
         os.makedirs(output_dir)