pyalamake 2.3.2__tar.gz → 2.4.0__tar.gz
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.
- {pyalamake-2.3.2/src/pyalamake.egg-info → pyalamake-2.4.0}/PKG-INFO +3 -2
- {pyalamake-2.3.2 → pyalamake-2.4.0}/README.md +1 -1
- {pyalamake-2.3.2 → pyalamake-2.4.0}/pyproject.toml +2 -1
- {pyalamake-2.3.2 → pyalamake-2.4.0}/setup.cfg +1 -1
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/constants_version.py +1 -1
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/gbl.py +2 -14
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/osal.py +71 -40
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/package_opengl.py +2 -2
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/path_handle.py +2 -2
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/pyalamake.py +19 -9
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/svc.py +12 -5
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_arduino.py +2 -2
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_base.py +1 -1
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_c_cpp_lib_base.py +3 -3
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_gtest.py +2 -2
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_swig.py +1 -1
- {pyalamake-2.3.2 → pyalamake-2.4.0/src/pyalamake.egg-info}/PKG-INFO +3 -2
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake.egg-info/requires.txt +1 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/LICENSE.txt +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/MANIFEST.in +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/__init__.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/arduino_shared.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/boards.json +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/compile_cmd_json.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/list_param.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/makefile_variables.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/package_cpip.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_arduino_core.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_base_min.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_c.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_c_cpp_base.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_c_lib.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_cpp.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_cpp_lib.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake/target_manual.py +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake.egg-info/SOURCES.txt +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake.egg-info/dependency_links.txt +0 -0
- {pyalamake-2.3.2 → pyalamake-2.4.0}/src/pyalamake.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyalamake
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: python module to generate Makefiles for arduino, GTest, C/C++, etc.
|
|
5
5
|
Author-email: "J. Arrizza" <cppgent0@gmail.com>
|
|
6
6
|
Maintainer-email: "J. Arrizza" <cppgent0@gmail.com>
|
|
@@ -19,6 +19,7 @@ Requires-Python: >=3.9
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE.txt
|
|
21
21
|
Requires-Dist: falcon-logger
|
|
22
|
+
Requires-Dist: pyosal
|
|
22
23
|
Dynamic: license-file
|
|
23
24
|
|
|
24
25
|
* website: [Website](https://arrizza.com/pyalamake.html)
|
|
@@ -116,7 +117,7 @@ OK do_arduino_install: install rc=0 Servo
|
|
|
116
117
|
It will generate two files:
|
|
117
118
|
* Makefile - a top level makefile that handles including the correct
|
|
118
119
|
makefile for the current OS.
|
|
119
|
-
* One of Makefile.ubuntu, Makefile.macos, Makefile.
|
|
120
|
+
* One of Makefile.ubuntu, Makefile.macos, Makefile.msys2 - the OS specific makefile
|
|
120
121
|
|
|
121
122
|
* run `make help` to confirm that all of the targets have been generated
|
|
122
123
|
* run `make xx` to run build a specific target.
|
|
@@ -93,7 +93,7 @@ OK do_arduino_install: install rc=0 Servo
|
|
|
93
93
|
It will generate two files:
|
|
94
94
|
* Makefile - a top level makefile that handles including the correct
|
|
95
95
|
makefile for the current OS.
|
|
96
|
-
* One of Makefile.ubuntu, Makefile.macos, Makefile.
|
|
96
|
+
* One of Makefile.ubuntu, Makefile.macos, Makefile.msys2 - the OS specific makefile
|
|
97
97
|
|
|
98
98
|
* run `make help` to confirm that all of the targets have been generated
|
|
99
99
|
* run `make xx` to run build a specific target.
|
|
@@ -15,11 +15,12 @@ classifiers = [
|
|
|
15
15
|
# additional packages to install
|
|
16
16
|
dependencies = [
|
|
17
17
|
'falcon-logger',
|
|
18
|
+
'pyosal',
|
|
18
19
|
]
|
|
19
20
|
|
|
20
21
|
# common values
|
|
21
22
|
name = 'pyalamake'
|
|
22
|
-
version = '2.
|
|
23
|
+
version = '2.4.0'
|
|
23
24
|
requires-python = '>=3.9'
|
|
24
25
|
authors = [{ name = 'J. Arrizza', email = 'cppgent0@gmail.com' }]
|
|
25
26
|
maintainers = [
|
|
@@ -9,7 +9,7 @@ disable = C0114,C0115,C0116,C0415,R0801,R0903,R0912,R0913,R0917,W0511
|
|
|
9
9
|
max-line-length = 140
|
|
10
10
|
ignore = E266,E402,E731,E203
|
|
11
11
|
statistics = True
|
|
12
|
-
exclude = venv/*, pf_*, setup.py, debug/*, release/*
|
|
12
|
+
exclude = venv/*, out/*, pf_*, setup.py, debug/*, release/*
|
|
13
13
|
|
|
14
14
|
[coverage:run]
|
|
15
15
|
omit =
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import sys
|
|
1
|
+
from pyosal import pyosal
|
|
3
2
|
|
|
4
3
|
|
|
5
4
|
# --------------------
|
|
@@ -24,18 +23,7 @@ class Gbl:
|
|
|
24
23
|
## constructor
|
|
25
24
|
def __init__(self):
|
|
26
25
|
## holds the current OS name
|
|
27
|
-
self.os_name =
|
|
28
|
-
# NOTE: has to use os.path.isfile here since the current OS is unknown
|
|
29
|
-
if os.path.isfile('/sys/firmware/devicetree/base/model'): # pragma: no cover
|
|
30
|
-
self.os_name = 'rpi'
|
|
31
|
-
elif sys.platform == 'win32': # pragma: no cover
|
|
32
|
-
self.os_name = 'win'
|
|
33
|
-
elif sys.platform == 'darwin': # pragma: no cover
|
|
34
|
-
self.os_name = 'macos'
|
|
35
|
-
elif sys.platform == 'linux':
|
|
36
|
-
self.os_name = 'ubuntu'
|
|
37
|
-
else:
|
|
38
|
-
print(f'unrecognized OS: "{sys.platform}"') # pragma: no cover ; defence only
|
|
26
|
+
self.os_name = pyosal.os_name
|
|
39
27
|
|
|
40
28
|
# --------------------
|
|
41
29
|
## override the default build directory name
|
|
@@ -42,7 +42,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
42
42
|
# @return C++ compiler
|
|
43
43
|
@classmethod
|
|
44
44
|
def cpp_compiler(cls):
|
|
45
|
-
if svc.
|
|
45
|
+
if svc.pyosal.os_name == 'macos':
|
|
46
46
|
comp = 'g++-15'
|
|
47
47
|
else:
|
|
48
48
|
comp = 'g++'
|
|
@@ -53,7 +53,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
53
53
|
# @return C compiler
|
|
54
54
|
@classmethod
|
|
55
55
|
def c_compiler(cls):
|
|
56
|
-
if svc.
|
|
56
|
+
if svc.pyosal.os_name == 'macos':
|
|
57
57
|
comp = 'gcc-15'
|
|
58
58
|
else:
|
|
59
59
|
comp = 'gcc'
|
|
@@ -67,9 +67,9 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
67
67
|
# @return the root arduino directory
|
|
68
68
|
@classmethod
|
|
69
69
|
def arduino_root_dir(cls):
|
|
70
|
-
if svc.
|
|
70
|
+
if svc.pyosal.os_name == 'macos':
|
|
71
71
|
path = os.path.expanduser('~/Library/Arduino15')
|
|
72
|
-
elif svc.
|
|
72
|
+
elif svc.pyosal.os_name == 'msys2':
|
|
73
73
|
path = os.path.expanduser('~/AppData/Local/Arduino15')
|
|
74
74
|
path = path.replace('\\', '/')
|
|
75
75
|
else: # ubuntu
|
|
@@ -83,9 +83,10 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
83
83
|
# @return the root arduino library directory
|
|
84
84
|
@classmethod
|
|
85
85
|
def arduino_library_dir(cls):
|
|
86
|
-
|
|
86
|
+
# TODO use arduino_root_dir?
|
|
87
|
+
if svc.pyosal.os_name == 'macos':
|
|
87
88
|
path = os.path.expanduser('~/Library/Arduino15/libraries')
|
|
88
|
-
elif svc.
|
|
89
|
+
elif svc.pyosal.os_name == 'msys2':
|
|
89
90
|
path = os.path.expanduser('~/AppData/Local/Arduino15/libraries')
|
|
90
91
|
path = path.replace('\\', '/')
|
|
91
92
|
else: # ubuntu
|
|
@@ -99,8 +100,8 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
99
100
|
# @return the arduino core's root source directory
|
|
100
101
|
@classmethod
|
|
101
102
|
def arduino_core_src_dir(cls):
|
|
102
|
-
#
|
|
103
|
-
path = f'{cls.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.
|
|
103
|
+
# TODO get these using arduinocli
|
|
104
|
+
path = f'{cls.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.8/cores/arduino'
|
|
104
105
|
# do not fix_path()
|
|
105
106
|
return path
|
|
106
107
|
|
|
@@ -110,11 +111,10 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
110
111
|
# @return the list of include directories
|
|
111
112
|
@classmethod
|
|
112
113
|
def arduino_core_includes(cls):
|
|
114
|
+
# TODO get these using arduinocli
|
|
113
115
|
incs = [
|
|
114
|
-
|
|
115
|
-
f'{cls.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.
|
|
116
|
-
# f'{cls.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.6/variants/standard',
|
|
117
|
-
f'{cls.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.7/variants/standard',
|
|
116
|
+
f'{cls.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.8/cores/arduino',
|
|
117
|
+
f'{cls.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.8/variants/standard',
|
|
118
118
|
]
|
|
119
119
|
# do not fix_path()
|
|
120
120
|
return incs
|
|
@@ -125,6 +125,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
125
125
|
# @return the tools directory
|
|
126
126
|
@classmethod
|
|
127
127
|
def arduino_tools_dir(cls):
|
|
128
|
+
# TODO get this using arduinocli
|
|
128
129
|
path = f'{cls.arduino_root_dir()}/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin'
|
|
129
130
|
return path
|
|
130
131
|
|
|
@@ -134,7 +135,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
134
135
|
# @return the avrdude directory
|
|
135
136
|
@classmethod
|
|
136
137
|
def avrdude_dir(cls):
|
|
137
|
-
#
|
|
138
|
+
# TODO get this using arduinocli
|
|
138
139
|
path = f'{cls.arduino_root_dir()}/packages/arduino/tools/avrdude/8.0.0-arduino1/bin'
|
|
139
140
|
# do not fix_path()
|
|
140
141
|
return path
|
|
@@ -145,7 +146,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
145
146
|
# @return the avrdude directory
|
|
146
147
|
@classmethod
|
|
147
148
|
def avrdude_conf_dir(cls):
|
|
148
|
-
#
|
|
149
|
+
# TODO get this using arduinocli
|
|
149
150
|
path = f'{cls.arduino_root_dir()}/packages/arduino/tools/avrdude/8.0.0-arduino1/etc'
|
|
150
151
|
# do not fix_path()
|
|
151
152
|
return path
|
|
@@ -159,9 +160,9 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
159
160
|
@classmethod
|
|
160
161
|
def gtest_includes(cls):
|
|
161
162
|
incs = []
|
|
162
|
-
if svc.
|
|
163
|
+
if svc.pyosal.os_name == 'msys2':
|
|
163
164
|
incs.append('c:/msys64/mingw64/include')
|
|
164
|
-
elif svc.
|
|
165
|
+
elif svc.pyosal.os_name == 'macos':
|
|
165
166
|
incs.append('/opt/homebrew/Cellar/googletest/1.17.0/include')
|
|
166
167
|
|
|
167
168
|
# do not fix_path()
|
|
@@ -174,9 +175,9 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
174
175
|
@classmethod
|
|
175
176
|
def gtest_link_dirs(cls):
|
|
176
177
|
dirs = []
|
|
177
|
-
if svc.
|
|
178
|
+
if svc.pyosal.os_name == 'msys2':
|
|
178
179
|
dirs.append('c:/msys64/mingw64/lib')
|
|
179
|
-
elif svc.
|
|
180
|
+
elif svc.pyosal.os_name == 'macos':
|
|
180
181
|
dirs.append('/opt/homebrew/Cellar/googletest/1.17.0/lib')
|
|
181
182
|
# do not fix_path()
|
|
182
183
|
return dirs
|
|
@@ -189,6 +190,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
189
190
|
# @return the list of include directories
|
|
190
191
|
@classmethod
|
|
191
192
|
def python_includes(cls):
|
|
193
|
+
svc.log.warn('@@>>@@ DEPRECATE: pyalamake.python_includes()')
|
|
192
194
|
import sysconfig
|
|
193
195
|
|
|
194
196
|
incs = [sysconfig.get_path('include')]
|
|
@@ -201,9 +203,10 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
201
203
|
# @return the list of link libraries
|
|
202
204
|
@classmethod
|
|
203
205
|
def python_link_libs(cls):
|
|
206
|
+
svc.log.warn('@@>>@@ DEPRECATE: pyalamake.python_link_libs()')
|
|
204
207
|
import sysconfig
|
|
205
208
|
|
|
206
|
-
if svc.
|
|
209
|
+
if svc.pyosal.os_name == 'msys2':
|
|
207
210
|
libs = [sysconfig.get_config_var('installed_base'), 'c:/msys64/mingw64/lib']
|
|
208
211
|
else:
|
|
209
212
|
libs = [sysconfig.get_config_var('LIBDIR')]
|
|
@@ -219,21 +222,27 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
219
222
|
## default include path(s) for python when installed using vfox
|
|
220
223
|
@property
|
|
221
224
|
def vfox_python_includes(cls):
|
|
225
|
+
if svc.pyosal.os_name in ['msys2']:
|
|
226
|
+
return [f'{cls._home}/.vfox/cache/python/v-3.12.3/python-3.12.3/include']
|
|
222
227
|
return [f'{cls._home}/.vfox/cache/python/v-3.12.3/python-3.12.3/include/python3.12']
|
|
223
228
|
|
|
224
229
|
# --------------------
|
|
225
230
|
## default library path(s) for python when installed using vfox
|
|
226
231
|
@property
|
|
227
232
|
def vfox_python_link_dirs(cls):
|
|
233
|
+
if svc.pyosal.os_name in ['msys2']:
|
|
234
|
+
return [f'{cls._home}/.vfox/cache/python/v-3.12.3/python-3.12.3/libs']
|
|
228
235
|
return [f'{cls._home}/.vfox/cache/python/v-3.12.3/python-3.12.3/lib']
|
|
229
236
|
|
|
230
237
|
# --------------------
|
|
231
238
|
## default libraries for python when installed using vfox
|
|
232
239
|
# ubuntu: not used
|
|
233
240
|
# macos : needed
|
|
234
|
-
# win :
|
|
241
|
+
# win : needed
|
|
235
242
|
@property
|
|
236
243
|
def vfox_python_libs(cls):
|
|
244
|
+
if svc.pyosal.os_name in ['msys2']:
|
|
245
|
+
return 'python312'
|
|
237
246
|
return 'python3.12'
|
|
238
247
|
|
|
239
248
|
# === ruby related
|
|
@@ -244,6 +253,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
244
253
|
# @return the list of include directories
|
|
245
254
|
@classmethod
|
|
246
255
|
def ruby_includes(cls):
|
|
256
|
+
svc.log.warn('@@>>@@ DEPRECATE: pyalamake.ruby_includes()')
|
|
247
257
|
incs = [cls._get_ruby_inc1(), cls._get_ruby_inc2()]
|
|
248
258
|
|
|
249
259
|
# do not fix_path()
|
|
@@ -255,17 +265,19 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
255
265
|
# @return path
|
|
256
266
|
@classmethod
|
|
257
267
|
def _get_ruby_inc1(cls):
|
|
268
|
+
svc.log.warn('@@>>@@ DEPRECATE: pyalamake.ruby_inc1()')
|
|
258
269
|
cmd = ['ruby', '-rrbconfig', '-e', 'puts RbConfig::CONFIG["rubyhdrdir"]']
|
|
259
270
|
result = subprocess.run(cmd, capture_output=True, text=True, check=True, shell=False)
|
|
260
271
|
lines = result.stdout.strip().splitlines()
|
|
261
272
|
if lines:
|
|
262
273
|
inc1 = lines[0].strip()
|
|
263
274
|
else:
|
|
264
|
-
if svc.
|
|
275
|
+
if svc.pyosal.os_name == 'macos':
|
|
265
276
|
inc1 = '/opt/homebrew/Cellar/ruby/3.3.5/include/ruby-3.3.0'
|
|
266
|
-
elif svc.
|
|
277
|
+
elif svc.pyosal.os_name == 'ubuntu':
|
|
267
278
|
inc1 = '/usr/include/ruby-3.2.0'
|
|
268
|
-
else:
|
|
279
|
+
else: # 'msys2'
|
|
280
|
+
# TODO get from vfox
|
|
269
281
|
# TODO del; check if these work in msys2
|
|
270
282
|
# C:/Ruby33-x64/include/ruby-3.3.0
|
|
271
283
|
inc1 = 'unknown_inc1'
|
|
@@ -277,17 +289,18 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
277
289
|
# @return path
|
|
278
290
|
@classmethod
|
|
279
291
|
def _get_ruby_inc2(cls):
|
|
292
|
+
svc.log.warn('@@>>@@ DEPRECATE: pyalamake.ruby_inc2()')
|
|
280
293
|
cmd = ['ruby', '-rrbconfig', '-e', 'puts RbConfig::CONFIG["rubyarchhdrdir"]']
|
|
281
294
|
result = subprocess.run(cmd, capture_output=True, text=True, check=True, shell=False)
|
|
282
295
|
lines = result.stdout.strip().splitlines()
|
|
283
296
|
if lines:
|
|
284
297
|
inc2 = lines[0].strip()
|
|
285
298
|
else:
|
|
286
|
-
if svc.
|
|
299
|
+
if svc.pyosal.os_name == 'macos':
|
|
287
300
|
inc2 = '/opt/homebrew/Cellar/ruby/3.3.5/include/ruby-3.3.0'
|
|
288
|
-
elif svc.
|
|
301
|
+
elif svc.pyosal.os_name == 'ubuntu':
|
|
289
302
|
inc2 = '/usr/include/x86_64-linux-gnu/ruby-3.2.0'
|
|
290
|
-
else:
|
|
303
|
+
else: # 'wini'
|
|
291
304
|
inc2 = 'C:/ruby/include/ruby-3.3.0/x64-mingw-ucrt'
|
|
292
305
|
return inc2
|
|
293
306
|
|
|
@@ -297,6 +310,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
297
310
|
# @return the list of link directories
|
|
298
311
|
@classmethod
|
|
299
312
|
def ruby_link_dirs(cls):
|
|
313
|
+
svc.log.warn('@@>>@@ DEPRECATE: pyalamake.ruby_link_dirs()')
|
|
300
314
|
dirs = [cls._get_ruby_lib()]
|
|
301
315
|
|
|
302
316
|
# do not fix_path()
|
|
@@ -308,14 +322,15 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
308
322
|
# @return link library
|
|
309
323
|
@classmethod
|
|
310
324
|
def _get_ruby_lib(cls):
|
|
325
|
+
svc.log.warn('@@>>@@ DEPRECATE: pyalamake.get_ruby_lib()')
|
|
311
326
|
cmd = ['ruby', '-rrbconfig', '-e', 'puts RbConfig::CONFIG["libdir"]']
|
|
312
327
|
result = subprocess.run(cmd, capture_output=True, text=True, check=True, shell=False)
|
|
313
328
|
lines = result.stdout.strip().splitlines()
|
|
314
329
|
if lines:
|
|
315
330
|
lib = lines[0].strip()
|
|
316
|
-
elif svc.
|
|
331
|
+
elif svc.pyosal.os_name == 'macos':
|
|
317
332
|
lib = '/opt/homebrew/Cellar/ruby/3.3.5/lib'
|
|
318
|
-
elif svc.
|
|
333
|
+
elif svc.pyosal.os_name == 'msys2':
|
|
319
334
|
lib = 'C:/ruby/lib'
|
|
320
335
|
else: # ubuntu
|
|
321
336
|
lib = '/usr/lib'
|
|
@@ -328,8 +343,9 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
328
343
|
# @return the list of link libraries
|
|
329
344
|
@classmethod
|
|
330
345
|
def ruby_link_libs(cls):
|
|
346
|
+
svc.log.warn('@@>>@@ DEPRECATE: pyalamake.ruby_link_libs()')
|
|
331
347
|
libs = []
|
|
332
|
-
if svc.
|
|
348
|
+
if svc.pyosal.os_name == 'msys2':
|
|
333
349
|
libs.append('x64-ucrt-ruby330.dll')
|
|
334
350
|
# do not fix_path()
|
|
335
351
|
return libs
|
|
@@ -340,12 +356,15 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
340
356
|
def vfox_ruby_includes(cls):
|
|
341
357
|
incs = []
|
|
342
358
|
# these must be first:
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
359
|
+
root_dir = f'{cls._home}/.vfox/cache/ruby/v-3.4.5/ruby-3.4.5/include/ruby-3.4.0'
|
|
360
|
+
if svc.pyosal.os_name == 'ubuntu':
|
|
361
|
+
incs.append(f'{root_dir}/x86_64-linux')
|
|
362
|
+
elif svc.pyosal.os_name == 'macos':
|
|
363
|
+
incs.append(f'{root_dir}/arm64-darwin20')
|
|
364
|
+
elif svc.pyosal.os_name == 'msys2':
|
|
365
|
+
incs.append(f'{root_dir}//x64-mingw-ucrt')
|
|
366
|
+
|
|
367
|
+
incs.append(root_dir)
|
|
349
368
|
return incs
|
|
350
369
|
|
|
351
370
|
# --------------------
|
|
@@ -358,9 +377,14 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
358
377
|
## default libraries for ruby when installed using vfox
|
|
359
378
|
# ubuntu: not used
|
|
360
379
|
# macos : needed
|
|
361
|
-
# win :
|
|
380
|
+
# win : needed
|
|
362
381
|
@property
|
|
363
382
|
def vfox_ruby_libs(cls):
|
|
383
|
+
if svc.pyosal.os_name == 'msys2':
|
|
384
|
+
return 'x64-ucrt-ruby340.dll'
|
|
385
|
+
if svc.pyosal.os_name == 'ubuntu':
|
|
386
|
+
return 'ruby-static'
|
|
387
|
+
# macos:
|
|
364
388
|
return 'ruby.3.4-static'
|
|
365
389
|
|
|
366
390
|
# === nodejs related
|
|
@@ -370,17 +394,23 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
370
394
|
@property
|
|
371
395
|
def vfox_nodejs_includes(cls):
|
|
372
396
|
return [
|
|
373
|
-
f'{cls._home}/.vfox/cache/nodejs/v-
|
|
397
|
+
f'{cls._home}/.vfox/cache/nodejs/v-24.16.0/nodejs-24.16.0/include/node',
|
|
374
398
|
]
|
|
375
399
|
|
|
400
|
+
# --------------------
|
|
401
|
+
## default library path(s) for ruby when installed using vfox
|
|
402
|
+
@property
|
|
403
|
+
def vfox_nodejs_link_dirs(cls):
|
|
404
|
+
return [f'{cls._home}/.vfox/cache/nodejs/v-24.16.0/nodejs-24.16.0']
|
|
405
|
+
|
|
376
406
|
# --------------------
|
|
377
407
|
## default libraries for ruby when installed using vfox
|
|
378
408
|
# ubuntu: not used
|
|
379
409
|
# macos : needed
|
|
380
|
-
# win :
|
|
410
|
+
# win : needed
|
|
381
411
|
@property
|
|
382
412
|
def vfox_nodejs_libs(cls):
|
|
383
|
-
return '
|
|
413
|
+
return 'node'
|
|
384
414
|
|
|
385
415
|
# === utility functions
|
|
386
416
|
|
|
@@ -412,6 +442,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
412
442
|
# @return rc, output lines
|
|
413
443
|
@classmethod
|
|
414
444
|
def run_cmd(cls, cmd):
|
|
445
|
+
svc.log.warn('@@>>@@ DEPRECATE: pyalamake.run_cmd()')
|
|
415
446
|
result = subprocess.run(
|
|
416
447
|
cmd,
|
|
417
448
|
capture_output=True, # Capture stdout and stderr
|
|
@@ -429,7 +460,7 @@ class _MetaOsal(type): # pylint: disable=too-many-public-methods
|
|
|
429
460
|
def _unfix_path(cls, path):
|
|
430
461
|
path = os.path.expanduser(path)
|
|
431
462
|
path = svc.gbl.mf_variables.unfix_path(path)
|
|
432
|
-
if svc.
|
|
463
|
+
if svc.pyosal.os_name == 'msys2':
|
|
433
464
|
# assumes there is only one character and it is for a drive letter
|
|
434
465
|
# can only be done at the start of the path
|
|
435
466
|
m = re.search(r'^/(.)/(.*)', path)
|
|
@@ -14,7 +14,7 @@ class PackageOpengl:
|
|
|
14
14
|
def find(self, pkgname):
|
|
15
15
|
svc.log.line(f'finding package: {pkgname}')
|
|
16
16
|
|
|
17
|
-
if svc.
|
|
17
|
+
if svc.pyosal.os_name == 'ubuntu':
|
|
18
18
|
#
|
|
19
19
|
@dataclass
|
|
20
20
|
class OpenGl:
|
|
@@ -23,7 +23,7 @@ class PackageOpengl:
|
|
|
23
23
|
link_dir = [] # not needed
|
|
24
24
|
link_options = [] # not needed
|
|
25
25
|
|
|
26
|
-
elif svc.
|
|
26
|
+
elif svc.pyosal.os_name == 'macos':
|
|
27
27
|
# TODO use this for include_dir: brew --prefix freeglut
|
|
28
28
|
@dataclass
|
|
29
29
|
class OpenGl:
|
|
@@ -16,7 +16,7 @@ class PathHandle:
|
|
|
16
16
|
|
|
17
17
|
home = os.path.expanduser('~')
|
|
18
18
|
home_pfx = home
|
|
19
|
-
if svc.
|
|
19
|
+
if svc.pyosal.os_name == 'msys2':
|
|
20
20
|
home_pfx = home_pfx.replace('\\', '/')
|
|
21
21
|
home_pfx = home_pfx.replace('//', '/')
|
|
22
22
|
|
|
@@ -32,7 +32,7 @@ class PathHandle:
|
|
|
32
32
|
if self._embedded.startswith(home_pfx):
|
|
33
33
|
# make the embedded paths more similar
|
|
34
34
|
self._embedded = self._embedded.replace(home_pfx, 'os_home')
|
|
35
|
-
if svc.
|
|
35
|
+
if svc.pyosal.os_name == 'msys2':
|
|
36
36
|
# convert "stuff/c:/xx" to stuff/c/xx
|
|
37
37
|
# note: if the path starts with "c:/" then it is left as is
|
|
38
38
|
# make can handle c:/abc/def format as long as it is at the start of the path
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from falcon_logger import FalconLogger
|
|
2
|
+
from pyosal import pyosal
|
|
2
3
|
|
|
3
4
|
from .arduino_shared import ArduinoShared
|
|
4
5
|
from .compile_cmd_json import CompileCmdJson
|
|
@@ -22,6 +23,7 @@ class AlaMake:
|
|
|
22
23
|
svc.gbl = Gbl()
|
|
23
24
|
svc.gbl.mf_variables = MakefileVariables()
|
|
24
25
|
svc.osal = Osal # not an instance, it is the class
|
|
26
|
+
svc.pyosal = pyosal
|
|
25
27
|
|
|
26
28
|
## list of targets
|
|
27
29
|
self._targets = []
|
|
@@ -46,25 +48,33 @@ class AlaMake:
|
|
|
46
48
|
## return True if OS is RPI
|
|
47
49
|
@property
|
|
48
50
|
def is_rpi(self):
|
|
49
|
-
return svc.
|
|
51
|
+
return svc.pyosal.os_name == 'rpi'
|
|
50
52
|
|
|
51
53
|
# --------------------
|
|
52
|
-
## return True if OS is
|
|
54
|
+
## return True if OS is Window powershell (future)
|
|
53
55
|
@property
|
|
54
56
|
def is_win(self):
|
|
55
|
-
|
|
57
|
+
# TODO deprecated
|
|
58
|
+
svc.log.warn('@@>>@@ DEPRECATED alamake.is_win; use is_msys2')
|
|
59
|
+
return svc.pyosal.os_name == 'msys2'
|
|
60
|
+
|
|
61
|
+
# --------------------
|
|
62
|
+
## return True if OS is Msys2
|
|
63
|
+
@property
|
|
64
|
+
def is_msys2(self):
|
|
65
|
+
return svc.pyosal.os_name == 'msys2'
|
|
56
66
|
|
|
57
67
|
# --------------------
|
|
58
68
|
## return True if OS is macoOS
|
|
59
69
|
@property
|
|
60
70
|
def is_macos(self):
|
|
61
|
-
return svc.
|
|
71
|
+
return svc.pyosal.os_name == 'macos'
|
|
62
72
|
|
|
63
73
|
# --------------------
|
|
64
74
|
## return True if OS is Ubuntu
|
|
65
75
|
@property
|
|
66
76
|
def is_ubuntu(self):
|
|
67
|
-
return svc.
|
|
77
|
+
return svc.pyosal.os_name == 'ubuntu'
|
|
68
78
|
|
|
69
79
|
# --------------------
|
|
70
80
|
## return the version string for pyalamake
|
|
@@ -324,7 +334,7 @@ class AlaMake:
|
|
|
324
334
|
# @param ut_path (UT only) the path to the makefile to generate; default: Makefile
|
|
325
335
|
# @return None
|
|
326
336
|
def makefile(self, ut_path=None):
|
|
327
|
-
svc.log.start(f'generating makefile for OS {svc.
|
|
337
|
+
svc.log.start(f'generating makefile for OS {svc.pyosal.os_name}...')
|
|
328
338
|
|
|
329
339
|
self._gather_targets()
|
|
330
340
|
|
|
@@ -332,7 +342,7 @@ class AlaMake:
|
|
|
332
342
|
if ut_path: # pragma: no cover ; only path used in UTs
|
|
333
343
|
path = ut_path
|
|
334
344
|
else:
|
|
335
|
-
path = f'Makefile.{svc.
|
|
345
|
+
path = f'Makefile.{svc.pyosal.os_name}' # pragma: no cover ; not used in UTs
|
|
336
346
|
svc.log.highlight(f'generating makefile {path}...')
|
|
337
347
|
self._gen_variables()
|
|
338
348
|
self._gen_rules()
|
|
@@ -486,11 +496,11 @@ class AlaMake:
|
|
|
486
496
|
content += ' OS_NAME := $(shell c:/msys64/usr/bin/uname.exe -s)\n'
|
|
487
497
|
content += ' ifeq ($(findstring MINGW64,$(OS_NAME)),MINGW64)\n'
|
|
488
498
|
content += ' PLATFORM := msys2\n'
|
|
489
|
-
content += ' include Makefile.
|
|
499
|
+
content += ' include Makefile.msys2\n'
|
|
490
500
|
content += ' else ifeq ($(findstring MSYS,$(OS_NAME)),MSYS)\n'
|
|
491
501
|
content += ' # for CLion\n'
|
|
492
502
|
content += ' PLATFORM := msys2\n'
|
|
493
|
-
content += ' include Makefile.
|
|
503
|
+
content += ' include Makefile.msys2\n'
|
|
494
504
|
content += ' else\n'
|
|
495
505
|
content += ' # Handle other operating systems or raise an error\n'
|
|
496
506
|
content += ' $(error Unsupported windows OS: "$(OS_NAME)")\n'
|
|
@@ -10,6 +10,9 @@ class svc: # pylint: disable=invalid-name
|
|
|
10
10
|
## holds OS Abstraction Layer
|
|
11
11
|
osal = None
|
|
12
12
|
|
|
13
|
+
## holds common OS commands
|
|
14
|
+
pyosal = None
|
|
15
|
+
|
|
13
16
|
# --------------------
|
|
14
17
|
## abort the current script.
|
|
15
18
|
# Note: do not use logging here since it may fail to write correctly
|
|
@@ -20,9 +23,13 @@ class svc: # pylint: disable=invalid-name
|
|
|
20
23
|
def abort(cls, msg='abort occurred, exiting'):
|
|
21
24
|
if svc.log:
|
|
22
25
|
svc.log.save()
|
|
23
|
-
import sys
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if svc.pyosal:
|
|
28
|
+
svc.pyosal.abort(msg)
|
|
29
|
+
else:
|
|
30
|
+
import sys
|
|
31
|
+
|
|
32
|
+
print(f'ABRT {msg}')
|
|
33
|
+
sys.stdout.flush()
|
|
34
|
+
sys.stdout.buffer.flush()
|
|
35
|
+
sys.exit(1)
|
|
@@ -151,7 +151,7 @@ class TargetArduino(TargetBase):
|
|
|
151
151
|
# @param _lib unused
|
|
152
152
|
# @return None
|
|
153
153
|
def _add_pkg_wire(self, _lib):
|
|
154
|
-
path = PathHandle(f'{svc.osal.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.
|
|
154
|
+
path = PathHandle(f'{svc.osal.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.8/libraries/Wire/src')
|
|
155
155
|
# built-in package, no installation
|
|
156
156
|
self.add_sources(
|
|
157
157
|
[
|
|
@@ -166,7 +166,7 @@ class TargetArduino(TargetBase):
|
|
|
166
166
|
# @param _lib unused
|
|
167
167
|
# @return None
|
|
168
168
|
def _add_pkg_spi(self, _lib):
|
|
169
|
-
path = PathHandle(f'{svc.osal.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.
|
|
169
|
+
path = PathHandle(f'{svc.osal.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.8/libraries/SPI/src')
|
|
170
170
|
# built-in package, no installation
|
|
171
171
|
self.add_sources(f'{path.fixed}/SPI.cpp')
|
|
172
172
|
self.add_include_directories(path.fixed) # pylint: disable=E1101
|
|
@@ -208,7 +208,7 @@ class TargetBase(TargetBaseMin): # pylint: disable=too-many-instance-attributes
|
|
|
208
208
|
#
|
|
209
209
|
# @return None
|
|
210
210
|
def add_homebrew(self):
|
|
211
|
-
if svc.
|
|
211
|
+
if svc.pyosal.os_name == 'macos': # pragma: no cover ; only used on macos
|
|
212
212
|
self.add_link_directories(svc.osal.homebrew_link_dirs()) # pylint: disable=E1101
|
|
213
213
|
self.add_include_directories(svc.osal.homebrew_inc_dirs()) # pylint: disable=E1101
|
|
214
214
|
|
|
@@ -130,7 +130,7 @@ class TargetCCppLibBase(TargetBase):
|
|
|
130
130
|
|
|
131
131
|
self._writeln(f'-include {mmd_inc_ph.fixed}')
|
|
132
132
|
self._writeln(f'{obj_ph.fixed}: {src_file_ph.fixed}')
|
|
133
|
-
if self._lib_type == 'shared' and svc.
|
|
133
|
+
if self._lib_type == 'shared' and svc.pyosal.os_name != 'msys2':
|
|
134
134
|
fpic = '-fPIC '
|
|
135
135
|
else:
|
|
136
136
|
fpic = ''
|
|
@@ -152,10 +152,10 @@ class TargetCCppLibBase(TargetBase):
|
|
|
152
152
|
self.add_rule(rule)
|
|
153
153
|
tgt_deps = f'{self.target}-init '
|
|
154
154
|
|
|
155
|
-
if svc.
|
|
155
|
+
if svc.pyosal.os_name == 'msys2': # pragma: no cover ; used only on windows
|
|
156
156
|
extension = 'dll'
|
|
157
157
|
fpic = ''
|
|
158
|
-
elif svc.
|
|
158
|
+
elif svc.pyosal.os_name == 'macos':
|
|
159
159
|
fpic = ''
|
|
160
160
|
if self._lib_type == 'bundle':
|
|
161
161
|
extension = 'bundle'
|
|
@@ -51,13 +51,13 @@ class TargetGtest(TargetBase):
|
|
|
51
51
|
|
|
52
52
|
## list of link libraries to add
|
|
53
53
|
self.add_link_libraries(['gtest', 'pthread']) # pylint: disable=E1101
|
|
54
|
-
if svc.
|
|
54
|
+
if svc.pyosal.os_name != 'macos': # pragma: no cover ; only skipped on macos
|
|
55
55
|
self.add_link_libraries('gcov') # pylint: disable=E1101
|
|
56
56
|
|
|
57
57
|
## list of link directories to add
|
|
58
58
|
self.add_link_directories(svc.osal.gtest_link_dirs()) # pylint: disable=E1101
|
|
59
59
|
|
|
60
|
-
if svc.
|
|
60
|
+
if svc.pyosal.os_name == 'macos': # pragma: no cover ; only used on macos
|
|
61
61
|
self.add_link_options('--coverage')
|
|
62
62
|
|
|
63
63
|
## list of coverage directories
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyalamake
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: python module to generate Makefiles for arduino, GTest, C/C++, etc.
|
|
5
5
|
Author-email: "J. Arrizza" <cppgent0@gmail.com>
|
|
6
6
|
Maintainer-email: "J. Arrizza" <cppgent0@gmail.com>
|
|
@@ -19,6 +19,7 @@ Requires-Python: >=3.9
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE.txt
|
|
21
21
|
Requires-Dist: falcon-logger
|
|
22
|
+
Requires-Dist: pyosal
|
|
22
23
|
Dynamic: license-file
|
|
23
24
|
|
|
24
25
|
* website: [Website](https://arrizza.com/pyalamake.html)
|
|
@@ -116,7 +117,7 @@ OK do_arduino_install: install rc=0 Servo
|
|
|
116
117
|
It will generate two files:
|
|
117
118
|
* Makefile - a top level makefile that handles including the correct
|
|
118
119
|
makefile for the current OS.
|
|
119
|
-
* One of Makefile.ubuntu, Makefile.macos, Makefile.
|
|
120
|
+
* One of Makefile.ubuntu, Makefile.macos, Makefile.msys2 - the OS specific makefile
|
|
120
121
|
|
|
121
122
|
* run `make help` to confirm that all of the targets have been generated
|
|
122
123
|
* run `make xx` to run build a specific target.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|