-
Notifications
You must be signed in to change notification settings - Fork 4
/
pyzipista_support.py
56 lines (37 loc) · 1.31 KB
/
pyzipista_support.py
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
# coding: utf-8
# This file is part of https://github.com/marcus67/gitsynchista
import os
import sys
import six
if six.PY3:
from importlib import reload
global pyzipista_found
_pyzipista_found = False
PYZIPISTA_PATH = '../pyzipista'
PYZIPISTA_SCRIPT = os.path.join(PYZIPISTA_PATH, 'pyzipista.py')
path = os.path.abspath(PYZIPISTA_PATH)
if os.path.exists(path) and os.path.exists(PYZIPISTA_SCRIPT):
if not PYZIPISTA_PATH in sys.path:
# see http://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path
sys.path.append(PYZIPISTA_PATH)
import pyzipista
reload(pyzipista)
_pyzipista_found = True
def pyzipista_found():
return _pyzipista_found
def find_config(base_path):
config_file = None
for rel_path in pyzipista.CONFIG_FILE_SEARCH_PATH:
filename = os.path.join(base_path, rel_path, pyzipista.PYZIPISTA_CONFIG_FILE)
if os.path.exists(filename):
config_file = filename
break
return config_file
def load_config_file_and_check_zip_required(config_filename):
return pyzipista.load_config_file_and_check_zip_required(config_filename)
def load_config_file_and_zip(config_filename):
pyzipista.load_config_file_and_zip(config_filename)
def test():
print ("pyzipista_found()=%s" % str(pyzipista_found()))
if __name__ == '__main__':
test()