]> TLD Linux GIT Repositories - tld-ftp-admin.git/blob - modules/common.py
- non-integer releases are ok in TLD
[tld-ftp-admin.git] / modules / common.py
1 # vi: encoding=utf-8 ts=8 sts=4 sw=4 et
2
3 from __future__ import print_function
4
5 import os, sys, config
6
7 def fileexists(path):
8     if path[0] == '/':
9         fullpath = path
10     else:
11         fullpath = config.ftp_dir + path
12     return os.path.exists(fullpath)
13
14 def checkdir(dir):
15     if not fileexists(dir):
16         print('ERR: ' + config.value['ftp_dir']+'/' + dir + " does not exist", file=sys.stderr)
17         sys.exit(1)
18
19 if 'HOME' in os.environ:
20     ftpadmdir = os.environ['HOME'] + '/tld-ftp-admin'
21 else:
22     ftpadmdir = '..'
23
24 # noarchcachedir is dir where noarch files contents are stored for AI
25 # XXX: file reference where the AI resides
26 noarchcachedir = ftpadmdir + '/var/noarch-cache/'
27
28 tmpdir = ftpadmdir + '/var/tmp/'