+# vi: encoding=utf-8 ts=8 sts=4 sw=4 et
+
import os, sys, config
-def direxists(path):
- try:
- os.stat(config.value['ftp_dir']+'/'+path)
- except OSError, (errno, errmsg):
- return False
+def fileexists(path):
+ if path[0]=='/':
+ fullpath=path
else:
- return True
+ fullpath=config.ftp_dir+path
+ return os.path.exists(fullpath)
def checkdir(dir):
- if not direxists(sys.argv[1]):
- print config.value['ftp_dir']+'/'+sys.argv[1] + " does not exist"
- sys.exit(1)
+ if not fileexists(dir):
+ print config.value['ftp_dir']+'/' + dir + " does not exist"
+ sys.exit(1)
+
+if 'HOME' in os.environ:
+ ftpadmdir=os.environ['HOME']+'/pld-ftp-admin/'
+else:
+ ftpadmdir='../'
+noarchcachedir=ftpadmdir+'var/noarch-cache/'
+tmpdir=ftpadmdir+'var/tmp/'