-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSetup_custom.py
More file actions
129 lines (113 loc) · 5.52 KB
/
Setup_custom.py
File metadata and controls
129 lines (113 loc) · 5.52 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# ----------------------------------------------------------------------
# |
# | Setup_custom.py
# |
# | David Brownell <db@DavidBrownell.com>
# | 2023-05-22 15:23:22
# |
# ----------------------------------------------------------------------
# |
# | Copyright David Brownell 2023
# | Distributed under the Boost Software License, Version 1.0. See
# | accompanying file LICENSE_1_0.txt or copy at
# | http://www.boost.org/LICENSE_1_0.txt.
# |
# ----------------------------------------------------------------------
# pylint: disable=missing-module-docstring
import os
import uuid # pylint: disable=unused-import
from pathlib import Path
from typing import Dict, List, Optional, Union
from semantic_version import Version as SemVer # pylint: disable=unused-import
from Common_Foundation import PathEx # type: ignore # pylint: disable=import-error,unused-import
from Common_Foundation.Shell.All import CurrentShell # type: ignore # pylint: disable=import-error,unused-import
from Common_Foundation.Shell import Commands # type: ignore # pylint: disable=import-error,unused-import
from Common_Foundation.Streams.DoneManager import DoneManager # type: ignore # pylint: disable=import-error,unused-import
from Common_Foundation import Types # type: ignore # pylint: disable=import-error,unused-import
from RepositoryBootstrap import Configuration # type: ignore # pylint: disable=import-error,unused-import
from RepositoryBootstrap import Constants # type: ignore # pylint: disable=import-error,unused-import
# ----------------------------------------------------------------------
# Uncomment the decorator below to make this repository a mixin repository.
# Mixin repositories can not be activated on their own and cannot have tool
# or version specifications. Mixin repositories are valuable because they
# can provide scripts or tools that augment other repositories when activated.
#
# @Configuration.MixinRepository
def GetConfigurations() -> Union[
Configuration.Configuration,
Dict[
str, # configuration name
Configuration.Configuration,
],
]:
common_python_libraries: list[Configuration.VersionInfo] = []
configurations: dict[str, Configuration.Configuration] = {
"standard": Configuration.Configuration(
"Configuration for using the functionality",
[
Configuration.Dependency(
Constants.COMMON_FOUNDATION_REPOSITORY_ID,
"Common_Foundation",
"python310",
"https://github.com/davidbrownell/v4-Common_Foundation.git",
),
],
Configuration.VersionSpecs(
[], # tools
{
"Python": common_python_libraries,
}, # libraries
),
),
"dev": Configuration.Configuration(
"Configuration for developing the functionality.",
[
Configuration.Dependency(
uuid.UUID("e4170a9d-70f9-4615-85b6-d514055e62b6"),
"Common_PythonDevelopment",
"python310",
"https://github.com/davidbrownell/v4-Common_PythonDevelopment.git",
),
],
Configuration.VersionSpecs(
[], # tools
{
"Python": common_python_libraries + [
Configuration.VersionInfo("cx_freeze", SemVer("6.13.1")),
],
}, # libraries
),
),
}
return configurations
# ----------------------------------------------------------------------
# Note that it is safe to remove this function if it will never be used.
def GetCustomActions(
# Note that it is safe to remove any parameters that are not used
dm: DoneManager, # pylint: disable=unused-argument
explicit_configurations: Optional[List[str]], # pylint: disable=unused-argument
force: bool, # pylint: disable=unused-argument
interactive: Optional[bool], # pylint: disable=unused-argument
) -> List[Commands.Command]:
commands: List[Commands.Command] = []
root_dir = Path(__file__).parent
assert root_dir.is_dir(), root_dir
# Create a link to the foundation's .pylintrc file
foundation_root_file = Path(Types.EnsureValid(os.getenv(Constants.DE_FOUNDATION_ROOT_NAME))) / ".pylintrc"
assert foundation_root_file.is_file(), foundation_root_file
commands.append(
Commands.SymbolicLink(
root_dir / foundation_root_file.name,
foundation_root_file,
remove_existing=True,
relative_path=True,
),
)
# Create a link to WorkItemExtractor
commands.append(
Commands.SymbolicLink(
PathEx.EnsureExists(root_dir / "Scripts") / "WorkItemExtractor.py",
PathEx.EnsureExists(root_dir / "src" / "WorkItemExtractor" / "__main__.py"),
),
)
return commands