Newer
Older
####################################################################################################
#
# Patro - A Python library to make patterns for fashion design
# Copyright (C) 2018 Fabrice Salvaire
#
# This program 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
# (at your option) any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
####################################################################################################
####################################################################################################
import os
import sys
# Fixme: why ?
import Patro.Common.Path as PathTools # due to Path class
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
####################################################################################################
class OsFactory:
##############################################
def __init__(self):
if sys.platform.startswith('linux'):
self._name = 'linux'
elif sys.platform.startswith('win'):
self._name = 'windows'
elif sys.platform.startswith('darwin'):
self._name = 'osx'
##############################################
@property
def name(self):
return self._name
@property
def on_linux(self):
return self._name == 'linux'
@property
def on_windows(self):
return self._name == 'windows'
@property
def on_osx(self):
return self._name == 'osx'
OS = OsFactory()
####################################################################################################
patro_module_directory = _this_file.parents[1]
config_directory = _this_file.parent
####################################################################################################
class Logging:
default_config_file = 'logging.yml'
directories = (Path.config_directory,)
##############################################
@staticmethod
def find(config_file):
return PathTools.find(config_file, Logging.directories)