cengal.file_system.win_fs.global_install_uninstall

 1#!/usr/bin/env python
 2# coding=utf-8
 3
 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>
 5# 
 6# Licensed under the Apache License, Version 2.0 (the "License");
 7# you may not use this file except in compliance with the License.
 8# You may obtain a copy of the License at
 9# 
10#     http://www.apache.org/licenses/LICENSE-2.0
11# 
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18import os
19from contextlib import contextmanager
20if 'nt' == os.name:
21    from .shutil import install_module as shutil_install_module, uninstall_module as shutil_uninstall_module
22    from .path import install_module as path_install_module, uninstall_module as path_uninstall_module
23
24"""
25Module Docstring
26Docstrings: http://www.python.org/dev/peps/pep-0257/
27"""
28
29__author__ = "ButenkoMS <gtalk@butenkoms.space>"
30__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>"
31__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ]
32__license__ = "Apache License, Version 2.0"
33__version__ = "4.4.1"
34__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>"
35__email__ = "gtalk@butenkoms.space"
36# __status__ = "Prototype"
37__status__ = "Development"
38# __status__ = "Production"
39
40
41def global_install():
42    shutil_install_module()
43    path_install_module()
44
45
46def global_uninstall():
47    path_uninstall_module()
48    shutil_uninstall_module()
49
50
51@contextmanager
52def win_fs():
53    if 'nt' == os.name:
54        global_install()
55    try:
56        yield
57    except:
58        raise
59    finally:
60        if 'nt' == os.name:
61            global_uninstall()
def global_install():
42def global_install():
43    shutil_install_module()
44    path_install_module()
def global_uninstall():
47def global_uninstall():
48    path_uninstall_module()
49    shutil_uninstall_module()
@contextmanager
def win_fs():
52@contextmanager
53def win_fs():
54    if 'nt' == os.name:
55        global_install()
56    try:
57        yield
58    except:
59        raise
60    finally:
61        if 'nt' == os.name:
62            global_uninstall()