File size: 2,803 Bytes
53d730a
5f4b7ef
53d730a
 
 
148ffde
53d730a
915bb14
148ffde
 
 
 
915bb14
 
 
aa0de2b
da08d51
 
915bb14
 
 
 
 
da08d51
915bb14
 
da08d51
915bb14
 
 
 
da08d51
8c66c51
915bb14
da08d51
 
 
 
 
 
53d730a
 
8c66c51
da68aa8
5f4b7ef
 
 
 
 
 
 
925affe
5f4b7ef
 
a564ad8
27f76ed
cbf276d
e04f882
5f4b7ef
 
 
 
 
 
 
 
 
 
 
 
 
 
eaf1bb9
8e0448f
 
eaf1bb9
7327694
 
33b2b35
e04f882
779bab9
 
a66c139
27f76ed
e04f882
925affe
33b2b35
925affe
 
 
 
33b2b35
925affe
 
27f76ed
925affe
7327694
 
27f76ed
e04f882
 
 
 
 
 
 
7327694
27f76ed
 
7327694
27f76ed
e04f882
 
27f76ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import os
import shutil
from os import path
from zipfile import ZipFile
from shutil import make_archive
import sys

def main():
    print ("Basename: " ,path.basename(__file__))
    print (sys.argv[0])
    print ("Basename: " ,path.realpath(__file__))

    filename = "clipseg-master.zip"
    extract_dir = "clipseg"
    archive_format = "zip"

    if path.exists(filename):
        print ("yes zip location exists.")
        
        print ("filename :: ", filename)
        print ("extract_dir :: ", extract_dir)
        print ("archive_format :: ", archive_format)        

        src=path.realpath(filename)
        print ("zip location:", src)
        
        root_dir,tail = path.split(src)
        
        print ("split- root_dir:", root_dir)
        print ("split- tail:", tail)
        
        extract_dir=root_dir+'/'+extract_dir
        print ("extract_dir:", "./clipseg")
        
        shutil.unpack_archive(filename, extract_dir, archive_format)
        #shutil.make_archive("test","zip",root_dir)
        print ("Archive file unpacked successfully.")
    else:
        print ("Archive file unpacked un-successfully.")
    

if __name__=="__main__":
    main()

#import gradio as gr
#import git
#import os

#print('Get current working directory : ', os.getcwd())
#path=os.getcwd()
#path=os.getcwd()+"clipseg/"

#from pathlib import Path
#print('working path', Path.cwd())

#git.Git(path).clone("https://github.com/git")



#from zipfile import ZipFile
#ZipFile("clipseg-master.zip").extractall(path)

#import zipfile
#def un_zipFiles(path):
#    files=os.listdir(path)
#    for file in files:
#        if file.endswith('.zip'):
#            filePath=path+'/'+file
#            zip_file = zipfile.ZipFile(filePath)
#            for names in zip_file.namelist():
#                zip_file.extract(names,path)
#            zip_file.close()

#download_and_extract_zip_file()
#clone_github_repository()

#with gr.Blocks() as demo:
#demo.launch()

"""
import time
import git

git.Git("./clipseg").clone("https://github.com/git")
"""
#from git import RemoteProgress

#class CloneProgress(RemoteProgress):
#    def update(self, op_code, cur_count, max_count=None, message=''):
#        if message:
#            print(message)

#git_root='home/user/app/clipseg1'
#print('Cloning into %s' % git_root)
#git.Repo.clone_from('https://github.com/git', git_root, 
#        branch='master', progress=CloneProgress())

#-------------
"""
import sys
import os

from zipfile import ZipFile
zf = ZipFile('clipseg-master.zip', 'r')
zf.extractall('./clipseg')
zf.close()

path  = "./clipseg"
clone = "git clone https://github.com/git" 

os.system("sshpass -p password ssh nightfury@localhost")
os.chdir(path) # Specifying the path where the cloned project needs to be copied
os.system(clone) # Cloning
"""