proj-flow 0.8.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. proj_flow/__init__.py +4 -0
  2. proj_flow/__main__.py +10 -0
  3. proj_flow/api/__init__.py +10 -0
  4. proj_flow/api/arg.py +134 -0
  5. proj_flow/api/completers.py +93 -0
  6. proj_flow/api/ctx.py +238 -0
  7. proj_flow/api/env.py +416 -0
  8. proj_flow/api/init.py +26 -0
  9. proj_flow/api/makefile.py +140 -0
  10. proj_flow/api/step.py +173 -0
  11. proj_flow/base/__init__.py +11 -0
  12. proj_flow/base/cmd.py +50 -0
  13. proj_flow/base/inspect.py +133 -0
  14. proj_flow/base/matrix.py +240 -0
  15. proj_flow/base/plugins.py +44 -0
  16. proj_flow/base/uname.py +71 -0
  17. proj_flow/flow/__init__.py +11 -0
  18. proj_flow/flow/cli/__init__.py +66 -0
  19. proj_flow/flow/cli/cmds.py +385 -0
  20. proj_flow/flow/cli/finder.py +59 -0
  21. proj_flow/flow/configs.py +162 -0
  22. proj_flow/flow/dependency.py +153 -0
  23. proj_flow/flow/init.py +65 -0
  24. proj_flow/flow/interact.py +134 -0
  25. proj_flow/flow/layer.py +176 -0
  26. proj_flow/flow/steps.py +104 -0
  27. proj_flow/log/__init__.py +10 -0
  28. proj_flow/log/commit.py +463 -0
  29. proj_flow/log/fmt.py +12 -0
  30. proj_flow/log/format.py +13 -0
  31. proj_flow/log/hosting/__init__.py +11 -0
  32. proj_flow/log/hosting/github.py +248 -0
  33. proj_flow/log/msg.py +201 -0
  34. proj_flow/log/release.py +34 -0
  35. proj_flow/log/rich_text/__init__.py +22 -0
  36. proj_flow/log/rich_text/api.py +126 -0
  37. proj_flow/log/rich_text/markdown.py +61 -0
  38. proj_flow/log/rich_text/re_structured_text.py +68 -0
  39. proj_flow/plugins/__init__.py +8 -0
  40. proj_flow/plugins/base.py +30 -0
  41. proj_flow/plugins/cmake/__init__.py +11 -0
  42. proj_flow/plugins/cmake/__version__.py +5 -0
  43. proj_flow/plugins/cmake/build.py +29 -0
  44. proj_flow/plugins/cmake/config.py +59 -0
  45. proj_flow/plugins/cmake/context.py +112 -0
  46. proj_flow/plugins/cmake/pack.py +37 -0
  47. proj_flow/plugins/cmake/parser.py +166 -0
  48. proj_flow/plugins/cmake/test.py +29 -0
  49. proj_flow/plugins/commands/__init__.py +12 -0
  50. proj_flow/plugins/commands/bootstrap.py +21 -0
  51. proj_flow/plugins/commands/ci/__init__.py +17 -0
  52. proj_flow/plugins/commands/ci/changelog.py +47 -0
  53. proj_flow/plugins/commands/ci/matrix.py +46 -0
  54. proj_flow/plugins/commands/ci/release.py +116 -0
  55. proj_flow/plugins/commands/init.py +75 -0
  56. proj_flow/plugins/commands/list.py +167 -0
  57. proj_flow/plugins/commands/run.py +147 -0
  58. proj_flow/plugins/commands/system.py +60 -0
  59. proj_flow/plugins/conan/__init__.py +66 -0
  60. proj_flow/plugins/conan/_conan.py +146 -0
  61. proj_flow/plugins/github.py +13 -0
  62. proj_flow/plugins/sign/__init__.py +130 -0
  63. proj_flow/plugins/sign/win32.py +191 -0
  64. proj_flow/plugins/store/__init__.py +11 -0
  65. proj_flow/plugins/store/store_both.py +22 -0
  66. proj_flow/plugins/store/store_packages.py +79 -0
  67. proj_flow/plugins/store/store_tests.py +21 -0
  68. proj_flow/template/layers/base/.clang-format +27 -0
  69. proj_flow/template/layers/base/.flow/config.yml +38 -0
  70. proj_flow/template/layers/base/.flow/flow.py.mustache +172 -0
  71. proj_flow/template/layers/base/.flow/matrix.yml +63 -0
  72. proj_flow/template/layers/base/.flow/official.yml +4 -0
  73. proj_flow/template/layers/base/.gitignore +39 -0
  74. proj_flow/template/layers/base/README.md.mustache +2 -0
  75. proj_flow/template/layers/base/flow +7 -0
  76. proj_flow/template/layers/base/flow.cmd +9 -0
  77. proj_flow/template/layers/base.json +2 -0
  78. proj_flow/template/layers/cmake/.flow/cmake/common.cmake.mustache +27 -0
  79. proj_flow/template/layers/cmake/.flow/extensions/wall/__init__.py.mustache +2 -0
  80. proj_flow/template/layers/cmake/.flow/extensions/wall/icons/__init__.py.mustache +54 -0
  81. proj_flow/template/layers/cmake/.flow/extensions/wall/icons/magick.py.mustache +97 -0
  82. proj_flow/template/layers/cmake/.flow/packages/base.cmake.mustache +33 -0
  83. proj_flow/template/layers/cmake/.flow/packages/config.cmake +12 -0
  84. proj_flow/template/layers/cmake/.flow/packages/cpack.cmake +3 -0
  85. proj_flow/template/layers/cmake/.flow/packages/wix/cpack.cmake.mustache +1 -0
  86. proj_flow/template/layers/cmake/.flow/packages/wix/patches.in.wix +10 -0
  87. proj_flow/template/layers/cmake/.flow/packages/wix.cmake.mustache +13 -0
  88. proj_flow/template/layers/cmake/CMakeGraphVizOptions.cmake +8 -0
  89. proj_flow/template/layers/cmake/CMakeLists.txt.mustache +213 -0
  90. proj_flow/template/layers/cmake/CMakePresets.json +196 -0
  91. proj_flow/template/layers/cmake/data/assets/appicon.ico +0 -0
  92. proj_flow/template/layers/cmake/data/assets/appicon.png +0 -0
  93. proj_flow/template/layers/cmake/data/assets/wix_banner.bmp +0 -0
  94. proj_flow/template/layers/cmake/data/assets/wix_dialog.bmp +0 -0
  95. proj_flow/template/layers/cmake/data/icons/.gitignore +3 -0
  96. proj_flow/template/layers/cmake/data/icons/appicon-mask.svg +6 -0
  97. proj_flow/template/layers/cmake/data/icons/appicon.svg +27 -0
  98. proj_flow/template/layers/cmake/src/main.cc.mustache +38 -0
  99. proj_flow/template/layers/cmake/src/version.hpp.in.mustache +36 -0
  100. proj_flow/template/layers/cmake/tests/test.cc.mustache +17 -0
  101. proj_flow/template/layers/cmake.json +15 -0
  102. proj_flow/template/layers/conan/.flow/cmake/libcxx_toolchain.cmake +4 -0
  103. proj_flow/template/layers/conan/.flow/cmake/output_dirs_setup.cmake +19 -0
  104. proj_flow/template/layers/conan/conanfile.txt +9 -0
  105. proj_flow/template/layers/conan.json +3 -0
  106. proj_flow/template/layers/github_actions/.github/linters/.isort.cfg +4 -0
  107. proj_flow/template/layers/github_actions/.github/linters/.mypy.ini +2 -0
  108. proj_flow/template/layers/github_actions/.github/workflows/build.yml +241 -0
  109. proj_flow/template/layers/github_actions/.github/workflows/linter.yml +59 -0
  110. proj_flow/template/layers/github_actions/CPPLINT.cfg +16 -0
  111. proj_flow/template/layers/github_actions.json +3 -0
  112. proj_flow/template/layers/github_social/.github/ISSUE_TEMPLATE/bug_report.md.mustache +42 -0
  113. proj_flow/template/layers/github_social/.github/ISSUE_TEMPLATE/feature_request.md.mustache +28 -0
  114. proj_flow/template/layers/github_social/CODE_OF_CONDUCT.md.mustache +76 -0
  115. proj_flow/template/layers/github_social/CONTRIBUTING.md +10 -0
  116. proj_flow/template/layers/github_social.json +3 -0
  117. proj_flow/template/licenses/0BSD.mustache +12 -0
  118. proj_flow/template/licenses/MIT.mustache +21 -0
  119. proj_flow/template/licenses/Unlicense.mustache +24 -0
  120. proj_flow/template/licenses/WTFPL.mustache +13 -0
  121. proj_flow/template/licenses/Zlib.mustache +19 -0
  122. proj_flow-0.8.1.dist-info/METADATA +81 -0
  123. proj_flow-0.8.1.dist-info/RECORD +126 -0
  124. proj_flow-0.8.1.dist-info/WHEEL +4 -0
  125. proj_flow-0.8.1.dist-info/entry_points.txt +2 -0
  126. proj_flow-0.8.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env python3
2
+
3
+ # Copyright (c) 2025 Marcin Zdun
4
+ # This code is licensed under MIT license (see LICENSE for details)
5
+
6
+ import os
7
+ import re
8
+ import shutil
9
+ import subprocess
10
+ import sys
11
+ from contextlib import contextmanager
12
+ from dataclasses import dataclass
13
+ from typing import List, Optional, cast
14
+
15
+ CXX_FLOW_VERSION = "{{__flow_version__}}"
16
+ PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__))
17
+ VER_REGEX = re.compile(r"((?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*))")
18
+
19
+
20
+ @dataclass
21
+ class Version:
22
+ major: int
23
+ minor: int
24
+ patch: int
25
+
26
+ def compatible_with(self: "Version", runtime: Optional["Version"]):
27
+ if runtime is None:
28
+ return False
29
+ return self.major == runtime.major and self.minor <= runtime.minor
30
+
31
+ @staticmethod
32
+ def parse(value: str):
33
+ chunks = value.split("-")[0].split("+")[0].split(".")
34
+ try:
35
+ int_chunks = list(map(int, chunks))[0:3]
36
+ while len(int_chunks) < 3:
37
+ int_chunks.append(0)
38
+ return Version(*int_chunks)
39
+ except ValueError:
40
+ return None
41
+
42
+ @staticmethod
43
+ def proc_parse(process: subprocess.CompletedProcess):
44
+ value = cast(str, process.stdout).strip() if process.returncode == 0 else ""
45
+ m = VER_REGEX.search(value)
46
+ return Version.parse(m.group(0)) if m is not None else None
47
+
48
+
49
+ proj_flow = Version.parse(CXX_FLOW_VERSION)
50
+
51
+ PYTHON_EXECUTABLE = sys.executable
52
+
53
+
54
+ def python(
55
+ *args: List[str],
56
+ module: Optional[str] = None,
57
+ capture_output: bool = True,
58
+ ) -> subprocess.CompletedProcess:
59
+ if module is not None:
60
+ return subprocess.run(
61
+ [PYTHON_EXECUTABLE, "-m", module, *args],
62
+ shell=False,
63
+ capture_output=capture_output,
64
+ )
65
+ return subprocess.run(
66
+ [PYTHON_EXECUTABLE, *args], shell=False, capture_output=capture_output
67
+ )
68
+
69
+
70
+ def pip(*args: List[str], capture_output: bool = False):
71
+ return python(*args, module="pip", capture_output=capture_output)
72
+
73
+
74
+ def venv(*args: List[str], capture_output: bool = False):
75
+ return python(*args, module="venv", capture_output=capture_output)
76
+
77
+
78
+ def cxx_flow_version(print_output=False):
79
+ proc = subprocess.run(
80
+ "proj-flow --version", shell=True, encoding="UTF-8", capture_output=True
81
+ )
82
+ result = Version.proc_parse(proc)
83
+ if result is None and print_output:
84
+ if proc.stdout:
85
+ print(proc.stdout)
86
+ if proc.stderr:
87
+ print(proc.stderr, file=sys.stderr)
88
+ return result
89
+
90
+
91
+ @contextmanager
92
+ def cd(path: str):
93
+ prev = os.getcwd()
94
+ os.chdir(path)
95
+ try:
96
+ yield
97
+ finally:
98
+ os.chdir(prev)
99
+
100
+
101
+ def get_venv_path():
102
+ bindir = os.path.join(".venv", "bin")
103
+ scripts = os.path.join(".venv", "Scripts")
104
+
105
+ if os.path.isdir(bindir):
106
+ return bindir
107
+
108
+ if os.path.isdir(scripts):
109
+ return scripts
110
+
111
+ return None
112
+
113
+
114
+ def activate_virtual_env():
115
+ global PYTHON_EXECUTABLE
116
+
117
+ with cd(os.path.dirname(__file__)):
118
+ exec_ext = ".exe" if sys.platform == "win32" else ""
119
+ python_exec = f"python{exec_ext}"
120
+ bindir = get_venv_path()
121
+ has_venv = bindir is not None and os.path.isfile(
122
+ os.path.join(bindir, python_exec)
123
+ )
124
+
125
+ if not has_venv:
126
+ venv(".venv")
127
+ bindir = get_venv_path()
128
+
129
+ os.environ["PATH"] = (
130
+ f"{os.path.abspath(bindir)}{os.pathsep}{os.environ['PATH']}"
131
+ )
132
+ PYTHON_EXECUTABLE = shutil.which("python") or sys.executable
133
+
134
+
135
+ def bootstrap_cxx_flow():
136
+ if proj_flow.compatible_with(cxx_flow_version()):
137
+ return True
138
+
139
+ if sys.prefix == sys.base_prefix:
140
+ activate_virtual_env()
141
+
142
+ if proj_flow.compatible_with(cxx_flow_version()):
143
+ return True
144
+
145
+ if pip("--version", capture_output=True).returncode != 0:
146
+ print("Cannot call pip as a module. Exiting.\n", file=sys.stderr)
147
+ sys.exit(1)
148
+
149
+ version_major = proj_flow.major
150
+ version_minor = proj_flow.minor
151
+ version_range = f">={version_major}.{version_minor},<{version_major + 1}"
152
+
153
+ if pip("install", f"proj-flow{version_range}").returncode != 0:
154
+ print("Cannot install proj-flow with current pip. Exiting.\n", file=sys.stderr)
155
+ sys.exit(1)
156
+
157
+ return proj_flow.compatible_with(cxx_flow_version(print_output=True))
158
+
159
+
160
+ def main():
161
+ if not bootstrap_cxx_flow():
162
+ print("Cannot find a working copy of proj-flow", file=sys.stderr)
163
+ return 1
164
+
165
+ with cd(PROJECT_ROOT):
166
+ return subprocess.run(
167
+ [shutil.which("proj-flow"), *sys.argv[1:]], shell=False
168
+ ).returncode
169
+
170
+
171
+ if __name__ == "__main__":
172
+ sys.exit(main())
@@ -0,0 +1,63 @@
1
+ matrix:
2
+ compiler: [ gcc, clang, msvc ]
3
+ build_type: [ Release, Debug ]
4
+ sanitizer: [ true, false ]
5
+ os: [ ubuntu, windows ]
6
+
7
+ exclude:
8
+ - { os: windows, compiler: clang }
9
+ - { os: windows, compiler: gcc }
10
+ - { os: ubuntu, compiler: msvc }
11
+ - { build_type: Release, sanitizer: true }
12
+
13
+ include:
14
+ - build_type: Debug
15
+ preset: debug
16
+ coverage: true
17
+
18
+ - build_type: Release
19
+ preset: release
20
+
21
+ - os: ubuntu
22
+ conan_settings: [ compiler.libcxx=libstdc++11 ]
23
+ build_generator: ninja
24
+ cpack_generator: [ TGZ, DEB ]
25
+ ubuntu: true
26
+ home: /home/runner
27
+
28
+ - os: windows
29
+ conan2_settings:
30
+ - compiler.cppstd=23
31
+ - compiler.runtime=dynamic
32
+ build_generator: msbuild
33
+ report_os: Windows
34
+ cpack_generator: [ ZIP, WIX ]
35
+ windows: true
36
+ home: C:/Users/runneradmin
37
+
38
+ - os: ubuntu
39
+ report_os: Linux
40
+
41
+ - compiler: gcc
42
+ report_compiler: GNU
43
+ gcc: true
44
+
45
+ - compiler: clang
46
+ report_compiler: Clang
47
+ clang: true
48
+
49
+ - compiler: msvc
50
+ report_compiler: MSVC
51
+ msvc: true
52
+
53
+ - os: ubuntu
54
+ build_type: Release
55
+ sanitizer: false
56
+
57
+ - os: windows
58
+ build_type: Release
59
+ conan_settings: [ compiler.runtime=MD ]
60
+
61
+ - os: windows
62
+ build_type: Debug
63
+ conan_settings: [ compiler.runtime=MDd ]
@@ -0,0 +1,4 @@
1
+ exclude:
2
+ - compiler: clang
3
+ - build_type: Debug
4
+ - sanitizer: true
@@ -0,0 +1,39 @@
1
+ # Prerequisites
2
+ *.d
3
+
4
+ # Compiled Object files
5
+ *.slo
6
+ *.lo
7
+ *.o
8
+ *.obj
9
+
10
+ # Precompiled Headers
11
+ *.gch
12
+ *.pch
13
+
14
+ # Compiled Dynamic libraries
15
+ *.so
16
+ *.dylib
17
+ *.dll
18
+
19
+ # Fortran module files
20
+ *.mod
21
+ *.smod
22
+
23
+ # Compiled Static libraries
24
+ *.lai
25
+ *.la
26
+ *.a
27
+ *.lib
28
+
29
+ # Executables
30
+ *.exe
31
+ *.out
32
+ *.app
33
+
34
+ build/
35
+ *.aps
36
+ *.pyc
37
+ web.log
38
+ super-linter.log
39
+ *.profraw
@@ -0,0 +1,2 @@
1
+ # {{PROJECT.NAME}}
2
+ {{PROJECT.DESCRIPTION}}
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ # Copyright (c) 2025 Marcin Zdun
4
+ # This code is licensed under MIT license (see LICENSE for details)
5
+
6
+ PROJECT_DIR=$(dirname "$(realpath $0)")
7
+ python "${PROJECT_DIR}/.flow/flow.py" "$@"
@@ -0,0 +1,9 @@
1
+ @rem Copyright (c) 2025 Marcin Zdun
2
+ @rem This code is licensed under MIT license (see LICENSE for details)
3
+
4
+ @echo off
5
+ if "%OS%"=="Windows_NT" setlocal
6
+ set DIRNAME=%~dp0
7
+ if "%DIRNAME%"=="" set DIRNAME=.
8
+
9
+ python "%DIRNAME%/.flow/flow.py" %*
@@ -0,0 +1,2 @@
1
+ {
2
+ }
@@ -0,0 +1,27 @@
1
+ function(add_project_test TARGET)
2
+ cmake_parse_arguments(PARSE_ARGV 1 TST "" "" "")
3
+ add_executable(${TARGET}-test ${TST_UNPARSED_ARGUMENTS})
4
+ set_target_properties(${TARGET}-test PROPERTIES FOLDER tests)
5
+ target_compile_options(${TARGET}-test PRIVATE {{${}}{{NAME_PREFIX}}_ADDITIONAL_COMPILE_FLAGS})
6
+ target_link_options(${TARGET}-test PRIVATE {{${}}{{NAME_PREFIX}}_ADDITIONAL_LINK_FLAGS})
7
+ target_include_directories(${TARGET}-test
8
+ PRIVATE
9
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests
10
+ ${CMAKE_CURRENT_BINARY_DIR})
11
+ endfunction()
12
+
13
+ function(add_win32_icon TARGET NAME)
14
+ set(RESNAME "${PROJECT_SOURCE_DIR}/data/assets/${NAME}")
15
+ set(RC "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.dir/icon.rc")
16
+ set(__content "// Copyright (c) {{COPY.YEAR}} {{COPY.HOLDER}}
17
+ // This code is licensed under {{COPY.LICENSE}} license (see LICENSE for details)
18
+ // This file was autogenerated. Do not edit.
19
+
20
+ LANGUAGE 9, 1
21
+
22
+ 100 ICON \"${RESNAME}\"
23
+ ")
24
+
25
+ file(GENERATE OUTPUT ${RC} CONTENT ${__content})
26
+ target_sources(${TARGET} PRIVATE "${RC}" "${RESNAME}")
27
+ endfunction()
@@ -0,0 +1,2 @@
1
+ # Copyright (c) {{COPY.YEAR}} {{COPY.HOLDER}}
2
+ # This code is licensed under {{COPY.LICENSE}} license (see LICENSE for details)
@@ -0,0 +1,54 @@
1
+ # Copyright (c) {{COPY.YEAR}} {{COPY.HOLDER}}
2
+ # This code is licensed under {{COPY.LICENSE}} license (see LICENSE for details)
3
+
4
+ import os
5
+
6
+ from proj_flow.api import env, step
7
+ from proj_flow.api.makefile import Makefile
8
+
9
+ from . import magick
10
+
11
+ ICONS = os.path.join("data", "icons")
12
+ ASSETS = os.path.join("data", "assets")
13
+ ICONS_PNG = os.path.join(ICONS, "png")
14
+ STENCIL = os.path.join(ICONS_PNG, "appicon.png")
15
+ SIZES = ["16", "24", "32", "48", "256"]
16
+
17
+ makefile = Makefile(
18
+ [
19
+ magick.svg_to_png(
20
+ output=STENCIL,
21
+ image=os.path.join(ICONS, "appicon.svg"),
22
+ mask=os.path.join(ICONS, "appicon-mask.svg"),
23
+ ),
24
+ *(
25
+ magick.resize(
26
+ output=os.path.join(ICONS_PNG, f"appicon-{size}.png"),
27
+ stencil=STENCIL,
28
+ size=size,
29
+ )
30
+ for size in SIZES
31
+ ),
32
+ magick.merge(
33
+ os.path.join(ASSETS, "appicon.ico"),
34
+ [os.path.join(ICONS_PNG, f"appicon-{size}.png") for size in SIZES],
35
+ ),
36
+ magick.mkdirs(ICONS_PNG),
37
+ magick.copy(
38
+ os.path.join(ICONS_PNG, f"appicon-256.png"),
39
+ os.path.join(ASSETS, f"appicon.png"),
40
+ ),
41
+ ]
42
+ )
43
+
44
+
45
+ @step.register
46
+ class IconsStep:
47
+ name = "Icons"
48
+ runs_before = ["Build"]
49
+
50
+ def platform_dependencies(self):
51
+ return [f"{magick.tool}>=6"]
52
+
53
+ def run(self, config: env.Config, rt: env.Runtime) -> int:
54
+ return makefile.run(rt)
@@ -0,0 +1,97 @@
1
+ # Copyright (c) {{COPY.YEAR}} {{COPY.HOLDER}}
2
+ # This code is licensed under {{COPY.LICENSE}} license (see LICENSE for details)
3
+
4
+ import os
5
+ import sys
6
+ from typing import List
7
+
8
+ from proj_flow.api.env import Runtime
9
+ from proj_flow.api.makefile import Rule, Statement
10
+
11
+ tool = "magick" if sys.platform == "win32" else "convert"
12
+
13
+
14
+ class MkDirs(Rule):
15
+ def command(self, _: Statement):
16
+ return []
17
+
18
+ def run(self, st: Statement, rt: Runtime):
19
+ for output in st.outputs:
20
+ result = rt.mkdirs(output)
21
+ if result:
22
+ return result
23
+ return 0
24
+
25
+
26
+ class Copy(Rule):
27
+ def command(self, _: Statement):
28
+ return []
29
+
30
+ def run(self, st: Statement, rt: Runtime):
31
+ return rt.cp(st.inputs[0], st.outputs[0])
32
+
33
+
34
+ class Magick:
35
+ class SvgToPng(Rule):
36
+ def command(self, st: Statement):
37
+ return [
38
+ tool,
39
+ "-background",
40
+ "none",
41
+ *st.inputs,
42
+ "-alpha",
43
+ "Off",
44
+ "-compose",
45
+ "CopyOpacity",
46
+ "-composite",
47
+ st.outputs[0],
48
+ ]
49
+
50
+ class Resize(Rule):
51
+ size: str
52
+
53
+ def __init__(self, size: str):
54
+ self.size = size
55
+
56
+ def command(self, st: Statement):
57
+ return [
58
+ tool,
59
+ "-background",
60
+ "none",
61
+ st.inputs[0],
62
+ "-resize",
63
+ f"{self.size}x{self.size}",
64
+ "-depth",
65
+ "32",
66
+ st.outputs[0],
67
+ ]
68
+
69
+ class Merge(Rule):
70
+ def command(self, st: Statement):
71
+ return [
72
+ tool,
73
+ *st.inputs,
74
+ st.outputs[0],
75
+ ]
76
+
77
+
78
+ def mkdirs(dirname: str):
79
+ return MkDirs.statement([dirname], [])
80
+
81
+
82
+ def copy(src: str, dst: str):
83
+ return Copy.statement([dst], [src])
84
+
85
+
86
+ def svg_to_png(output: str, image: str, mask: str):
87
+ return Magick.SvgToPng.statement([output], [image, mask], [os.path.dirname(output)])
88
+
89
+
90
+ def resize(output: str, stencil: str, size: str):
91
+ return Statement(
92
+ Magick.Resize(size), [output], [stencil], [os.path.dirname(output)]
93
+ )
94
+
95
+
96
+ def merge(output: str, layers: List[str]):
97
+ return Magick.Merge.statement([output], layers, [os.path.dirname(output)])
@@ -0,0 +1,33 @@
1
+ execute_process(COMMAND ${Python3_EXECUTABLE}
2
+ "${PROJECT_SOURCE_DIR}/.flow/flow.py" system --format=platform
3
+ OUTPUT_VARIABLE ___PACKAGE_NAME
4
+ OUTPUT_STRIP_TRAILING_WHITESPACE
5
+ )
6
+
7
+ set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
8
+ set(CPACK_PACKAGE_VENDOR "{{COPY.HOLDER}}")
9
+ set(CPACK_PACKAGE_CONTACT "{{COPY.HOLDER}} <{{PROJECT.EMAIL}}>")
10
+ set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
11
+ set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
12
+ set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
13
+ set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
14
+ set(CPACK_PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}")
15
+ set(CPACK_PACKAGE_INSTALL_DIRECTORY "{{PROJECT.NAME}}")
16
+ set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "{{COPY.HOLDER}}/{{PROJECT.NAME}}")
17
+ set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/data/assets/appicon-256.png")
18
+ set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}${PROJECT_VERSION_STABILITY}-${___PACKAGE_NAME}")
19
+
20
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT APPLE)
21
+ string(REPLACE "." ";" _COMPILER_CHUNKS ${CMAKE_CXX_COMPILER_VERSION})
22
+ list(GET _COMPILER_CHUNKS 0 CMAKE_CXX_COMPILER_VERSION_MAJOR)
23
+ set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-clang${CMAKE_CXX_COMPILER_VERSION_MAJOR}")
24
+ endif()
25
+
26
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
27
+ set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-dbg")
28
+ endif()
29
+
30
+ set(CPACK_PACKAGE_DIRECTORY "${PROJECT_BINARY_DIR}/packages")
31
+ set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_BINARY_DIR}/packages/_CPack_Packages/LICENSE.txt")
32
+ file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/packages/_CPack_Packages")
33
+ file(COPY_FILE "${PROJECT_SOURCE_DIR}/LICENSE" "${PROJECT_BINARY_DIR}/packages/_CPack_Packages/LICENSE.txt")
@@ -0,0 +1,12 @@
1
+ set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/cpack.cmake")
2
+
3
+ include(${CMAKE_CURRENT_LIST_DIR}/base.cmake)
4
+ include(${CMAKE_CURRENT_LIST_DIR}/wix.cmake)
5
+
6
+ set(CPACK_NSIS_MODIFY_PATH ON)
7
+
8
+ set(CPACK_DEB_COMPONENT_INSTALL ON)
9
+ set(CPACK_DEBIAN_APPS_PACKAGE_DEPENDS libgcc-s1)
10
+ set(CPACK_DEBIAN_DEVEL_PACKAGE_DEPENDS)
11
+
12
+ set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
@@ -0,0 +1,3 @@
1
+ if (CPACK_GENERATOR STREQUAL "WIX")
2
+ include(${CMAKE_CURRENT_LIST_DIR}/wix/cpack.cmake)
3
+ endif()
@@ -0,0 +1 @@
1
+ set(CPACK_PACKAGE_NAME "{{PROJECT.NAME}}")
@@ -0,0 +1,10 @@
1
+ <CPackWiXPatch>
2
+ <CPackWiXFragment Id="@PROJECT_WIX_BIN_DIR_COMP@">
3
+ <RegistryKey Root="HKLM" Key="Software\@PROJECT_REGISTRY_KEY@">
4
+ <RegistryValue Type="string" Name="Version" Value="@PROJECT_VERSION@@PROJECT_VERSION_STABILITY@" />
5
+ <RegistryValue Type="string" Value="[@PROJECT_WIX_BIN_DIR@]" />
6
+ </RegistryKey>
7
+ <Environment Id="@WIX_PATH_ID@" Name="PATH" Action="set" System="yes" Permanent="no" Part="last" Value="[@PROJECT_WIX_BIN_DIR@]" />
8
+ </CPackWiXFragment>
9
+ <CPackWiXFragment Id="#PRODUCTFEATURE" AllowAdvertise="no" />
10
+ </CPackWiXPatch>
@@ -0,0 +1,13 @@
1
+ set(CPACK_WIX_UPGRADE_GUID "{{PROJECT.WIX.UPGRADE_GUID}}")
2
+ set(CPACK_WIX_PRODUCT_ICON "${PROJECT_SOURCE_DIR}/data/assets/appicon.ico")
3
+ set(CPACK_WIX_UI_BANNER "${PROJECT_SOURCE_DIR}/data/assets/wix_banner.bmp")
4
+ set(CPACK_WIX_UI_DIALOG "${PROJECT_SOURCE_DIR}/data/assets/wix_dialog.bmp")
5
+ set(CPACK_WIX_ROOT_FEATURE_TITLE "{{PROJECT.NAME}} ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
6
+ set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_BINARY_DIR}/packages/_CPack_Packages/patches.wix")
7
+ set(PROJECT_WIX_BIN_DIR "CM_DP_bin")
8
+ set(PROJECT_WIX_BIN_DIR_COMP "CM_CP_bin.${CMAKE_PROJECT_NAME}.exe")
9
+ set(WIX_PATH_ID "{{NAME_PREFIX}}_PATH")
10
+ set(CPACK_WIX_VERSION 4)
11
+
12
+ string(REPLACE "/" "\\" PROJECT_REGISTRY_KEY ${CPACK_PACKAGE_INSTALL_REGISTRY_KEY})
13
+ configure_file(${CMAKE_CURRENT_LIST_DIR}/wix/patches.in.wix ${CMAKE_CURRENT_BINARY_DIR}/packages/_CPack_Packages/patches.wix @ONLY)
@@ -0,0 +1,8 @@
1
+ set(GRAPHVIZ_GRAPH_HEADER "graph [\n fontname = \"Montserrat SemiBold\";\n];\nnode [\n fontsize = \"12\";\n fontname = \"Montserrat\";\n];\nedge [\n fontname = \"Montserrat Light\";\n];")
2
+ set(GRAPHVIZ_GENERATE_PER_TARGET FALSE)
3
+ set(GRAPHVIZ_GENERATE_DEPENDERS FALSE)
4
+ set(GRAPHVIZ_IGNORE_TARGETS "CONAN_LIB::.*"
5
+ "GTest::.*"
6
+ ".*_DEPS_TARGET"
7
+ ".*-test"
8
+ )