]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blame - modules/common.py
more python3 readiness
[projects/pld-ftp-admin.git] / modules / common.py
CommitLineData
81e9387d
MM
1# vi: encoding=utf-8 ts=8 sts=4 sw=4 et
2
2ec96333
JR
3from __future__ import print_function
4
d9b3388c 5import os, sys, config
6ebc8df7 6
81e9387d 7def fileexists(path):
8911f226
ER
8 if path[0] == '/':
9 fullpath = path
81e9387d 10 else:
8911f226 11 fullpath = config.ftp_dir + path
e3aced8e 12 return os.path.exists(fullpath)
6ebc8df7
MM
13
14def checkdir(dir):
637d76b9 15 if not fileexists(dir):
2ec96333 16 print('ERR: ' + config.value['ftp_dir']+'/' + dir + " does not exist", file=sys.stderr)
81e9387d 17 sys.exit(1)
6ebc8df7 18
6992b18d 19if 'HOME' in os.environ:
304fcc79 20 ftpadmdir = os.environ['HOME'] + '/pld-ftp-admin'
6992b18d 21else:
304fcc79 22 ftpadmdir = '..'
151d31cc 23
8911f226
ER
24# noarchcachedir is dir where noarch files contents are stored for AI
25# XXX: file reference where the AI resides
304fcc79 26noarchcachedir = ftpadmdir + '/var/noarch-cache/'
8911f226 27
304fcc79 28tmpdir = ftpadmdir + '/var/tmp/'
This page took 0.832013 seconds and 4 git commands to generate.