22import  subprocess 
33import  sys 
44from  pathlib  import  Path 
5+ from  urllib  import  Request , urlopen 
56from  xml .etree  import  ElementTree  as  ET 
67
78UPLOAD_URL_PREFIX  =  os .getenv ("UPLOAD_URL_PREFIX" , "https://www.python.org/ftp/" )
@@ -76,7 +77,7 @@ def _run(*args):
7677
7778
7879def  call_ssh (* args , allow_fail = True ):
79-     if  not  UPLOAD_HOST  or  NO_UPLOAD   or   LOCAL_INDEX :
80+     if  not  UPLOAD_HOST  or  NO_UPLOAD :
8081        print ("Skipping" , args , "because UPLOAD_HOST is missing" )
8182        return 
8283    try :
@@ -87,7 +88,7 @@ def call_ssh(*args, allow_fail=True):
8788
8889
8990def  upload_ssh (source , dest ):
90-     if  not  UPLOAD_HOST  or  NO_UPLOAD   or   LOCAL_INDEX :
91+     if  not  UPLOAD_HOST  or  NO_UPLOAD :
9192        print ("Skipping upload of" , source , "because UPLOAD_HOST is missing" )
9293        return 
9394    _run (* _std_args (PSCP ), source , f"{ UPLOAD_USER }  @{ UPLOAD_HOST }  :{ dest }  " )
@@ -103,7 +104,7 @@ def download_ssh(source, dest):
103104
104105
105106def  ls_ssh (dest ):
106-     if  not  UPLOAD_HOST   or   LOCAL_INDEX :
107+     if  not  UPLOAD_HOST :
107108        print ("Skipping ls of" , dest , "because UPLOAD_HOST is missing" )
108109        return 
109110    try :
@@ -120,8 +121,6 @@ def url2path(url):
120121    if  not  url :
121122        raise  ValueError ("Unexpected empty URL" )
122123    if  not  url .startswith (UPLOAD_URL_PREFIX ):
123-         if  LOCAL_INDEX :
124-             return  url 
125124        raise  ValueError (f"Unexpected URL: { url }  " )
126125    return  UPLOAD_PATH_PREFIX  +  url [len (UPLOAD_URL_PREFIX ) :]
127126
0 commit comments