"""
Module will not import any other packages/modules only
what is needed for setup.py and docs. configuration.
Other parameters:
SETUP (mod)
__author__ (str): Project author.
__email__ (str): Author email
__description__ (str): Project description.
__version__ (str): Curent version.
"""
from __future__ import absolute_import
from __future__ import print_function
import shutil
import os
import pwd
import grp
from .constants import setup as SETUP
__author__ = SETUP.author
__email__ = SETUP.author_email
__description__ = SETUP.description
__version__ = SETUP.version
[docs]def initAppData(appData, filesPath, username):
print('\nSetup init application data:')
if os.path.exists(filesPath):
print('>>> Data already exists: ' + filesPath)
else:
print('... Copy default data')
shutil.copytree(appData, filesPath)
print('>>> Set owner: ' + username)
uid = pwd.getpwnam(username).pw_uid
gid = grp.getgrnam(username).gr_gid
os.chown(filesPath, uid, gid)
for root, dirs, files in os.walk(filesPath):
for ele in dirs + files:
os.chown(os.path.join(root, ele), uid, gid)
print('>>> Data path: ' + filesPath)