diff mbox series

[isar-cip-core,RFC,1/9] scripts/deploy-kernelci: Format python code and remove unused import

Message ID 20231023150243.3990309-2-Quirin.Gylstorff@siemens.com (mailing list archive)
State Superseded
Headers show
Series cleanup of customizations | expand

Commit Message

Gylstorff Quirin Oct. 23, 2023, 2:59 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 scripts/deploy-kernelci.py | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

Comments

Jan Kiszka Oct. 25, 2023, 4:28 p.m. UTC | #1
On 23.10.23 16:59, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 

Which style check did you use exactly?

> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  scripts/deploy-kernelci.py | 31 ++++++++++++++++---------------
>  1 file changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/scripts/deploy-kernelci.py b/scripts/deploy-kernelci.py
> index 5a8adca..62f3f01 100755
> --- a/scripts/deploy-kernelci.py
> +++ b/scripts/deploy-kernelci.py
> @@ -1,30 +1,30 @@
>  #!/usr/bin/env python3
>  # -*- coding: utf-8 -*-
>  
> -import subprocess
>  import requests
>  import os
>  import sys
>  import time
>  from urllib.parse import urljoin
>  
> -cdate=time.strftime("%Y%m%d")
> -api="https://api.kernelci.org/upload"
> -token=os.getenv("KERNELCI_TOKEN")
> +cdate = time.strftime("%Y%m%d")
> +api = "https://api.kernelci.org/upload"
> +token = os.getenv("KERNELCI_TOKEN")
>  
> -release=sys.argv[1]
> -target=sys.argv[2]
> -extension=sys.argv[3]
> +release = sys.argv[1]
> +target = sys.argv[2]
> +extension = sys.argv[3]
>  
> -rootfs_filename="cip-core-image-kernelci-cip-core-"+release+"-"+target+".tar.gz"
> -initrd_filename="cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img"
> -initrd_gz_filename="cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img.gz"
> +rootfs_filename = "cip-core-image-kernelci-cip-core-"+release+"-"+target+".tar.gz"
> +initrd_filename = "cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img"
> +initrd_gz_filename = "cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img.gz"
> +
> +input_dir = "build/tmp/deploy/images/"+target
> +upload_path = "/images/rootfs/cip/"+cdate+"/"+target+"/"
> +upload_path_latest = "/images/rootfs/cip/latest/"+target+"/"
> +rootfs = input_dir+"/"+rootfs_filename
> +initrd = input_dir+"/"+initrd_filename
>  
> -input_dir="build/tmp/deploy/images/"+target
> -upload_path="/images/rootfs/cip/"+cdate+"/"+target+"/"
> -upload_path_latest="/images/rootfs/cip/latest/"+target+"/"
> -rootfs=input_dir+"/"+rootfs_filename
> -initrd=input_dir+"/"+initrd_filename
>  
>  def upload_file(api, token, path, input_file, input_filename):
>      headers = {
> @@ -40,6 +40,7 @@ def upload_file(api, token, path, input_file, input_filename):
>      resp = requests.post(url, headers=headers, data=data, files=files)
>      resp.raise_for_status()
>  
> +
>  if os.path.exists(rootfs) and os.path.exists(initrd):
>      print("uploading rootfs to KernelCI")
>      upload_file(api, token, upload_path, rootfs, rootfs_filename)
Gylstorff Quirin Oct. 27, 2023, 3:01 p.m. UTC | #2
On 10/25/23 18:28, Jan Kiszka wrote:
> On 23.10.23 16:59, Quirin Gylstorff wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
> 
> Which style check did you use exactly?
> I used flake8 for this.
black rewrites much more.

Quirin

>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> ---
>>   scripts/deploy-kernelci.py | 31 ++++++++++++++++---------------
>>   1 file changed, 16 insertions(+), 15 deletions(-)
>>
>> diff --git a/scripts/deploy-kernelci.py b/scripts/deploy-kernelci.py
>> index 5a8adca..62f3f01 100755
>> --- a/scripts/deploy-kernelci.py
>> +++ b/scripts/deploy-kernelci.py
>> @@ -1,30 +1,30 @@
>>   #!/usr/bin/env python3
>>   # -*- coding: utf-8 -*-
>>   
>> -import subprocess
>>   import requests
>>   import os
>>   import sys
>>   import time
>>   from urllib.parse import urljoin
>>   
>> -cdate=time.strftime("%Y%m%d")
>> -api="https://api.kernelci.org/upload"
>> -token=os.getenv("KERNELCI_TOKEN")
>> +cdate = time.strftime("%Y%m%d")
>> +api = "https://api.kernelci.org/upload"
>> +token = os.getenv("KERNELCI_TOKEN")
>>   
>> -release=sys.argv[1]
>> -target=sys.argv[2]
>> -extension=sys.argv[3]
>> +release = sys.argv[1]
>> +target = sys.argv[2]
>> +extension = sys.argv[3]
>>   
>> -rootfs_filename="cip-core-image-kernelci-cip-core-"+release+"-"+target+".tar.gz"
>> -initrd_filename="cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img"
>> -initrd_gz_filename="cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img.gz"
>> +rootfs_filename = "cip-core-image-kernelci-cip-core-"+release+"-"+target+".tar.gz"
>> +initrd_filename = "cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img"
>> +initrd_gz_filename = "cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img.gz"
>> +
>> +input_dir = "build/tmp/deploy/images/"+target
>> +upload_path = "/images/rootfs/cip/"+cdate+"/"+target+"/"
>> +upload_path_latest = "/images/rootfs/cip/latest/"+target+"/"
>> +rootfs = input_dir+"/"+rootfs_filename
>> +initrd = input_dir+"/"+initrd_filename
>>   
>> -input_dir="build/tmp/deploy/images/"+target
>> -upload_path="/images/rootfs/cip/"+cdate+"/"+target+"/"
>> -upload_path_latest="/images/rootfs/cip/latest/"+target+"/"
>> -rootfs=input_dir+"/"+rootfs_filename
>> -initrd=input_dir+"/"+initrd_filename
>>   
>>   def upload_file(api, token, path, input_file, input_filename):
>>       headers = {
>> @@ -40,6 +40,7 @@ def upload_file(api, token, path, input_file, input_filename):
>>       resp = requests.post(url, headers=headers, data=data, files=files)
>>       resp.raise_for_status()
>>   
>> +
>>   if os.path.exists(rootfs) and os.path.exists(initrd):
>>       print("uploading rootfs to KernelCI")
>>       upload_file(api, token, upload_path, rootfs, rootfs_filename)
>
diff mbox series

Patch

diff --git a/scripts/deploy-kernelci.py b/scripts/deploy-kernelci.py
index 5a8adca..62f3f01 100755
--- a/scripts/deploy-kernelci.py
+++ b/scripts/deploy-kernelci.py
@@ -1,30 +1,30 @@ 
 #!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
-import subprocess
 import requests
 import os
 import sys
 import time
 from urllib.parse import urljoin
 
-cdate=time.strftime("%Y%m%d")
-api="https://api.kernelci.org/upload"
-token=os.getenv("KERNELCI_TOKEN")
+cdate = time.strftime("%Y%m%d")
+api = "https://api.kernelci.org/upload"
+token = os.getenv("KERNELCI_TOKEN")
 
-release=sys.argv[1]
-target=sys.argv[2]
-extension=sys.argv[3]
+release = sys.argv[1]
+target = sys.argv[2]
+extension = sys.argv[3]
 
-rootfs_filename="cip-core-image-kernelci-cip-core-"+release+"-"+target+".tar.gz"
-initrd_filename="cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img"
-initrd_gz_filename="cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img.gz"
+rootfs_filename = "cip-core-image-kernelci-cip-core-"+release+"-"+target+".tar.gz"
+initrd_filename = "cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img"
+initrd_gz_filename = "cip-core-image-kernelci-cip-core-"+release+"-"+target+"-initrd.img.gz"
+
+input_dir = "build/tmp/deploy/images/"+target
+upload_path = "/images/rootfs/cip/"+cdate+"/"+target+"/"
+upload_path_latest = "/images/rootfs/cip/latest/"+target+"/"
+rootfs = input_dir+"/"+rootfs_filename
+initrd = input_dir+"/"+initrd_filename
 
-input_dir="build/tmp/deploy/images/"+target
-upload_path="/images/rootfs/cip/"+cdate+"/"+target+"/"
-upload_path_latest="/images/rootfs/cip/latest/"+target+"/"
-rootfs=input_dir+"/"+rootfs_filename
-initrd=input_dir+"/"+initrd_filename
 
 def upload_file(api, token, path, input_file, input_filename):
     headers = {
@@ -40,6 +40,7 @@  def upload_file(api, token, path, input_file, input_filename):
     resp = requests.post(url, headers=headers, data=data, files=files)
     resp.raise_for_status()
 
+
 if os.path.exists(rootfs) and os.path.exists(initrd):
     print("uploading rootfs to KernelCI")
     upload_file(api, token, upload_path, rootfs, rootfs_filename)