-
Notifications
You must be signed in to change notification settings - Fork 6
/
pireal
executable file
·72 lines (59 loc) · 2.16 KB
/
pireal
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright 2015-2020 Gabriel Acosta <acostadariogabriel@gmail.com>
#
# This file is part of Pireal.
#
# Pireal is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# any later version.
#
# Pireal is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pireal; If not, see <http://www.gnu.org/licenses/>.
"""Script to run Pireal"""
import os
import sys
# import ctypes
# def create_dirs():
# """This functions create a structure folders used by Pireal"""
# pireal_dir = settings.PIREAL_DIR
# is_win = settings.IS_WINDOWS
# for path in (pireal_dir, settings.PIREAL_DATABASES, settings.LOGS_PATH):
# if not os.path.isdir(path):
# os.mkdir(path)
# if path == pireal_dir and is_win:
# # Set hide attribute if OS is WIndows
# ctypes.windll.kernel32.SetFileAttributesW(path, 0x02)
# Esto es reemplazado en tiempo de instalación
INSTALLED_BASE_DIR = '@ BASE_DIR @'
if os.path.exists(INSTALLED_BASE_DIR):
project_base_dir = INSTALLED_BASE_DIR
else:
project_base_dir = os.path.abspath(os.path.dirname(os.path.dirname(
os.path.realpath(sys.argv[0]))))
if project_base_dir not in sys.path:
sys.path.insert(0, project_base_dir)
from pireal.core import cliparser # noqa
from pireal import __version__ # noqa
from pireal.dirs import create_app_dirs # noqa
from pireal.core import settings # noqa
# Parse CLI
args = cliparser.get_cli().parse_args()
if args.version:
print(__version__)
sys.exit(0)
# Creo los dirs antes de leer logs. see #84
create_app_dirs()
from pireal.core import logger # noqa
from pireal import main # noqa
from pireal import resources # noqa
# Set up logger
logger.set_up(debug=args.debug, verbose=args.verbose)
main.start_pireal(args)