pyalamake 2.3.0__tar.gz → 2.3.2__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.
Files changed (39) hide show
  1. {pyalamake-2.3.0/src/pyalamake.egg-info → pyalamake-2.3.2}/PKG-INFO +1 -1
  2. {pyalamake-2.3.0 → pyalamake-2.3.2}/pyproject.toml +1 -1
  3. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/constants_version.py +1 -1
  4. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/osal.py +155 -63
  5. pyalamake-2.3.2/src/pyalamake/package_opengl.py +49 -0
  6. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_arduino.py +91 -8
  7. {pyalamake-2.3.0 → pyalamake-2.3.2/src/pyalamake.egg-info}/PKG-INFO +1 -1
  8. pyalamake-2.3.0/src/pyalamake/package_opengl.py +0 -23
  9. {pyalamake-2.3.0 → pyalamake-2.3.2}/LICENSE.txt +0 -0
  10. {pyalamake-2.3.0 → pyalamake-2.3.2}/MANIFEST.in +0 -0
  11. {pyalamake-2.3.0 → pyalamake-2.3.2}/README.md +0 -0
  12. {pyalamake-2.3.0 → pyalamake-2.3.2}/setup.cfg +0 -0
  13. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/__init__.py +0 -0
  14. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/arduino_shared.py +0 -0
  15. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/boards.json +0 -0
  16. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/compile_cmd_json.py +0 -0
  17. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/gbl.py +0 -0
  18. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/list_param.py +0 -0
  19. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/makefile_variables.py +0 -0
  20. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/package_cpip.py +0 -0
  21. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/path_handle.py +0 -0
  22. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/pyalamake.py +0 -0
  23. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/svc.py +0 -0
  24. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_arduino_core.py +0 -0
  25. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_base.py +0 -0
  26. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_base_min.py +0 -0
  27. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_c.py +0 -0
  28. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_c_cpp_base.py +0 -0
  29. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_c_cpp_lib_base.py +0 -0
  30. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_c_lib.py +0 -0
  31. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_cpp.py +0 -0
  32. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_cpp_lib.py +0 -0
  33. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_gtest.py +0 -0
  34. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_manual.py +0 -0
  35. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake/target_swig.py +0 -0
  36. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake.egg-info/SOURCES.txt +0 -0
  37. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake.egg-info/dependency_links.txt +0 -0
  38. {pyalamake-2.3.0 → pyalamake-2.3.2}/src/pyalamake.egg-info/requires.txt +0 -0
  39. {pyalamake-2.3.0 → pyalamake-2.3.2}/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.0
3
+ Version: 2.3.2
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,7 +19,7 @@ dependencies = [
19
19
 
20
20
  # common values
21
21
  name = 'pyalamake'
22
- version = '2.3.0'
22
+ version = '2.3.2'
23
23
  requires-python = '>=3.9'
24
24
  authors = [{ name = 'J. Arrizza', email = 'cppgent0@gmail.com' }]
25
25
  maintainers = [
@@ -6,4 +6,4 @@ from dataclasses import dataclass
6
6
  @dataclass
7
7
  class ConstantsVersion:
8
8
  ## current App version
9
- version = '2.3.0'
9
+ version = '2.3.2'
@@ -7,47 +7,11 @@ from .svc import svc
7
7
 
8
8
  # --------------------
9
9
  ## Operating System Abstraction Layer; provides functions to make cross-platform behavior similar
10
- class Osal:
11
- # --------------------
12
- ## check if a path to a file exists
13
- # note: use this function instead of os.path.isfile otherwise it may fail on windows/msys2
14
- #
15
- # @param path the path to fix
16
- # @return the fixed path
17
- @classmethod
18
- def isfile(cls, path):
19
- path = cls._unfix_path(path)
20
- return os.path.isfile(path)
10
+ class _MetaOsal(type): # pylint: disable=too-many-public-methods
11
+ ## prefix for paths with home in them
12
+ _home = os.path.expanduser('~')
21
13
 
22
- # --------------------
23
- ## check if a path exists
24
- # note: use this function instead of os.path.isdir otherwise it may fail on windows/msys2
25
- #
26
- # @param path the path to fix
27
- # @return the fixed path
28
- @classmethod
29
- def isdir(cls, path):
30
- path = cls._unfix_path(path)
31
- return os.path.isdir(path)
32
-
33
- # --------------------
34
- ## (deprecated) unfix a path
35
- # @param path the path to unfix
36
- # @return the unfixed path
37
- @classmethod
38
- def _unfix_path(cls, path):
39
- path = os.path.expanduser(path)
40
- path = svc.gbl.mf_variables.unfix_path(path)
41
- if svc.gbl.os_name == 'win':
42
- # assumes there is only one character and it is for a drive letter
43
- # can only be done at the start of the path
44
- m = re.search(r'^/(.)/(.*)', path)
45
- if m:
46
- drive = m.group(1).lower()
47
- path = f'{drive}:/{m.group(2)}'
48
- path = path.replace('\\', '/')
49
- path = path.replace('//', '/')
50
- return path
14
+ # === homebrew related
51
15
 
52
16
  # --------------------
53
17
  ## get the homebrew link libraries root directory
@@ -71,6 +35,8 @@ class Osal:
71
35
  # '/opt/homebrew/include',
72
36
  ]
73
37
 
38
+ # === C/C++ related
39
+
74
40
  # --------------------
75
41
  ## get C++ compiler per OS
76
42
  # @return C++ compiler
@@ -93,6 +59,8 @@ class Osal:
93
59
  comp = 'gcc'
94
60
  return svc.gbl.mf_variables.set_get('PAM_GCC', comp)
95
61
 
62
+ # === arduino related
63
+
96
64
  # --------------------
97
65
  ## get the root of the arduino cores, tools, etc.
98
66
  #
@@ -182,6 +150,8 @@ class Osal:
182
150
  # do not fix_path()
183
151
  return path
184
152
 
153
+ # === gtest related
154
+
185
155
  # --------------------
186
156
  ## return default gtest include directories
187
157
  #
@@ -211,6 +181,63 @@ class Osal:
211
181
  # do not fix_path()
212
182
  return dirs
213
183
 
184
+ # === python related
185
+
186
+ # --------------------
187
+ ## return default python include directories
188
+ #
189
+ # @return the list of include directories
190
+ @classmethod
191
+ def python_includes(cls):
192
+ import sysconfig
193
+
194
+ incs = [sysconfig.get_path('include')]
195
+ # do not fix_path()
196
+ return incs
197
+
198
+ # --------------------
199
+ ## return default link libraries needed for ruby
200
+ #
201
+ # @return the list of link libraries
202
+ @classmethod
203
+ def python_link_libs(cls):
204
+ import sysconfig
205
+
206
+ if svc.gbl.os_name == 'win':
207
+ libs = [sysconfig.get_config_var('installed_base'), 'c:/msys64/mingw64/lib']
208
+ else:
209
+ libs = [sysconfig.get_config_var('LIBDIR')]
210
+ # print(f"platlibdir : {sysconfig.get_config_var('platlibdir')}")
211
+ # print(f"installed_base: {sysconfig.get_config_var('installed_base')}")
212
+ # print(f"platbase : {sysconfig.get_config_var('platbase')}")
213
+ # libs = [sysconfig.get_config_var('prefix')]
214
+
215
+ # do not fix_path()
216
+ return libs
217
+
218
+ # --------------------
219
+ ## default include path(s) for python when installed using vfox
220
+ @property
221
+ def vfox_python_includes(cls):
222
+ return [f'{cls._home}/.vfox/cache/python/v-3.12.3/python-3.12.3/include/python3.12']
223
+
224
+ # --------------------
225
+ ## default library path(s) for python when installed using vfox
226
+ @property
227
+ def vfox_python_link_dirs(cls):
228
+ return [f'{cls._home}/.vfox/cache/python/v-3.12.3/python-3.12.3/lib']
229
+
230
+ # --------------------
231
+ ## default libraries for python when installed using vfox
232
+ # ubuntu: not used
233
+ # macos : needed
234
+ # win : TODO
235
+ @property
236
+ def vfox_python_libs(cls):
237
+ return 'python3.12'
238
+
239
+ # === ruby related
240
+
214
241
  # --------------------
215
242
  ## return default ruby include directories
216
243
  #
@@ -308,36 +335,76 @@ class Osal:
308
335
  return libs
309
336
 
310
337
  # --------------------
311
- ## return default python include directories
312
- #
313
- # @return the list of include directories
314
- @classmethod
315
- def python_includes(cls):
316
- import sysconfig
338
+ ## default include path(s) for ruby when installed using vfox
339
+ @property
340
+ def vfox_ruby_includes(cls):
341
+ incs = []
342
+ # these must be first:
343
+ if svc.gbl.os_name == 'ubuntu':
344
+ incs.append(f'{cls._home}/.vfox/cache/ruby/v-3.4.5/ruby-3.4.5/include/ruby-3.4.0/x86_64-linux')
345
+ elif svc.gbl.os_name == 'macos':
346
+ incs.append(f'{cls._home}/.vfox/cache/ruby/v-3.4.5/ruby-3.4.5/include/ruby-3.4.0/arm64-darwin20')
317
347
 
318
- incs = [sysconfig.get_path('include')]
319
- # do not fix_path()
348
+ incs.append(f'{cls._home}/.vfox/cache/ruby/v-3.4.5/ruby-3.4.5/include/ruby-3.4.0')
320
349
  return incs
321
350
 
322
351
  # --------------------
323
- ## return default link libraries needed for ruby
352
+ ## default library path(s) for ruby when installed using vfox
353
+ @property
354
+ def vfox_ruby_link_dirs(cls):
355
+ return [f'{cls._home}/.vfox/cache/ruby/v-3.4.5/ruby-3.4.5/lib']
356
+
357
+ # --------------------
358
+ ## default libraries for ruby when installed using vfox
359
+ # ubuntu: not used
360
+ # macos : needed
361
+ # win : TODO
362
+ @property
363
+ def vfox_ruby_libs(cls):
364
+ return 'ruby.3.4-static'
365
+
366
+ # === nodejs related
367
+
368
+ # --------------------
369
+ ## default library path(s) for nodejs when installed using vfox
370
+ @property
371
+ def vfox_nodejs_includes(cls):
372
+ return [
373
+ f'{cls._home}/.vfox/cache/nodejs/v-21.5.0/nodejs-21.5.0/include/node',
374
+ ]
375
+
376
+ # --------------------
377
+ ## default libraries for ruby when installed using vfox
378
+ # ubuntu: not used
379
+ # macos : needed
380
+ # win : TODO
381
+ @property
382
+ def vfox_nodejs_libs(cls):
383
+ return 'ruby.3.4-static'
384
+
385
+ # === utility functions
386
+
387
+ # --------------------
388
+ ## check if a path to a file exists
389
+ # note: use this function instead of os.path.isfile otherwise it may fail on windows/msys2
324
390
  #
325
- # @return the list of link libraries
391
+ # @param path the path to fix
392
+ # @return the fixed path
326
393
  @classmethod
327
- def python_link_libs(cls):
328
- import sysconfig
329
-
330
- if svc.gbl.os_name == 'win':
331
- libs = [sysconfig.get_config_var('installed_base'), 'c:/msys64/mingw64/lib']
332
- else:
333
- libs = [sysconfig.get_config_var('LIBDIR')]
334
- # print(f"platlibdir : {sysconfig.get_config_var('platlibdir')}")
335
- # print(f"installed_base: {sysconfig.get_config_var('installed_base')}")
336
- # print(f"platbase : {sysconfig.get_config_var('platbase')}")
337
- # libs = [sysconfig.get_config_var('prefix')]
394
+ def isfile(cls, path):
395
+ path = cls._unfix_path(path)
396
+ return os.path.isfile(path)
338
397
 
339
- # do not fix_path()
340
- return libs
398
+ # --------------------
399
+ ## check if a path exists
400
+ # note: use this function instead of os.path.isdir otherwise it may fail on windows/msys2
401
+ #
402
+ # @param path the path to fix
403
+ # @return the fixed path
404
+ @classmethod
405
+ def isdir(cls, path):
406
+ path = cls._unfix_path(path)
407
+ return os.path.isdir(path)
341
408
 
342
409
  # --------------------
343
410
  ## run a command
@@ -353,3 +420,28 @@ class Osal:
353
420
  ) # Raise error for non-zero exit codes
354
421
  # print(f'@@@ osal.run_cmd rc={result.returncode} stdout: {result.stdout.strip()}')
355
422
  return result.returncode, result.stdout.strip()
423
+
424
+ # --------------------
425
+ ## unfix a path
426
+ # @param path the path to unfix
427
+ # @return the unfixed path
428
+ @classmethod
429
+ def _unfix_path(cls, path):
430
+ path = os.path.expanduser(path)
431
+ path = svc.gbl.mf_variables.unfix_path(path)
432
+ if svc.gbl.os_name == 'win':
433
+ # assumes there is only one character and it is for a drive letter
434
+ # can only be done at the start of the path
435
+ m = re.search(r'^/(.)/(.*)', path)
436
+ if m:
437
+ drive = m.group(1).lower()
438
+ path = f'{drive}:/{m.group(2)}'
439
+ path = path.replace('\\', '/')
440
+ path = path.replace('//', '/')
441
+ return path
442
+
443
+
444
+ # --------------------
445
+ ## public metaclass for Osal
446
+ class Osal(metaclass=_MetaOsal): # pylint: disable=too-few-public-methods
447
+ pass
@@ -0,0 +1,49 @@
1
+ from dataclasses import dataclass
2
+
3
+ from .svc import svc
4
+
5
+
6
+ # --------------------
7
+ ## info for the OpenGL package
8
+ class PackageOpengl:
9
+ # --------------------
10
+ ## return info about the pkgname
11
+ #
12
+ # @param pkgname the name of the package; default: opengl
13
+ # @return ref to OpenGl info
14
+ def find(self, pkgname):
15
+ svc.log.line(f'finding package: {pkgname}')
16
+
17
+ if svc.gbl.os_name == 'ubuntu':
18
+ #
19
+ @dataclass
20
+ class OpenGl:
21
+ include_dir = '/usr/include'
22
+ link_libs = ['glut', 'GLU', 'GL']
23
+ link_dir = [] # not needed
24
+ link_options = [] # not needed
25
+
26
+ elif svc.gbl.os_name == 'macos':
27
+ # TODO use this for include_dir: brew --prefix freeglut
28
+ @dataclass
29
+ class OpenGl:
30
+ include_dir = []
31
+ link_libs = []
32
+ link_dir = []
33
+ link_options = [
34
+ '-framework GLUT',
35
+ '-framework OpenGL',
36
+ ]
37
+
38
+ else:
39
+
40
+ @dataclass
41
+ class OpenGl:
42
+ pass
43
+ # TODO: set up for win/msys2
44
+ # include_dir = []
45
+ # link_libs = []
46
+ # link_dir = []
47
+ # link_options = []
48
+
49
+ return OpenGl
@@ -78,16 +78,99 @@ class TargetArduino(TargetBase):
78
78
  # @param lib the library to add
79
79
  # @return None
80
80
  def add_library(self, lib):
81
- if lib == 'Servo':
82
- svc.log.line(f'adding arduino library: {lib}')
83
- path = PathHandle(f'{self._shared.library_root}/Servo/src')
84
- self._check_library_installed(path, lib)
85
- self.add_sources(f'{path.fixed}/avr/Servo.cpp') # pylint: disable=E1101
86
- self.add_include_directories(path.fixed) # pylint: disable=E1101
87
- self.add_compile_options('-DARDUINO_ARCH_AVR') # pylint: disable=E1101
88
- else:
81
+ # TODO use these:
82
+ # libraries: arduino-cli lib list "Adafruit Motor Shield V2 Library" --format json
83
+ # packages : arduino-cli lib list "Wire" -b arduino:avr:uno --format json
84
+ # dependcies: arduino-cli lib deps "Adafruit Motor Shield V2 Library"
85
+
86
+ valid_libs = {
87
+ 'Servo': self._add_lib_servo,
88
+ 'AdafruitMotorShieldV2': self._add_lib_motorshield_v2,
89
+ 'AdafruitBusIO': self._add_lib_busio,
90
+ # packages
91
+ 'Wire': self._add_pkg_wire,
92
+ 'SPI': self._add_pkg_spi,
93
+ }
94
+ if lib not in valid_libs:
89
95
  svc.abort(f'{self.target} target_arduino: unknown arduino library: {lib}')
90
96
 
97
+ svc.log.line(f'adding arduino library: {lib}')
98
+ valid_libs[lib](lib)
99
+
100
+ self.add_compile_options('-DARDUINO_ARCH_AVR') # pylint: disable=E1101
101
+
102
+ # --------------------
103
+ ## add Servo files
104
+ # @param lib the library to add
105
+ # @return None
106
+ def _add_lib_servo(self, lib):
107
+ path = PathHandle(f'{self._shared.library_root}/Servo/src')
108
+ self._check_library_installed(path, lib)
109
+ self.add_sources(f'{path.fixed}/avr/Servo.cpp') # pylint: disable=E1101
110
+ self.add_include_directories(path.fixed) # pylint: disable=E1101
111
+
112
+ # --------------------
113
+ ## add Adafruit Motor Shield V2 files
114
+ # @param lib the library to add
115
+ # @return None
116
+ def _add_lib_motorshield_v2(self, lib):
117
+ path = PathHandle(f'{self._shared.library_root}/Adafruit_Motor_Shield_V2_Library')
118
+ self._check_library_installed(path, lib)
119
+ self.add_sources(
120
+ [
121
+ f'{path.fixed}/Adafruit_MotorShield.cpp',
122
+ f'{path.fixed}/utility/Adafruit_MS_PWMServoDriver.cpp',
123
+ ]
124
+ ) # pylint: disable=E1101
125
+ self.add_include_directories(
126
+ [
127
+ path.fixed,
128
+ f'{path.fixed}/utility',
129
+ ]
130
+ ) # pylint: disable=E1101
131
+
132
+ # --------------------
133
+ ## add Adafruit Bus IO files
134
+ # @param lib the library to add
135
+ # @return None
136
+ def _add_lib_busio(self, lib):
137
+ path = PathHandle(f'{self._shared.library_root}/Adafruit_BusIO')
138
+ self._check_library_installed(path, lib)
139
+ self.add_sources(
140
+ [
141
+ f'{path.fixed}/Adafruit_BusIO_Register.cpp',
142
+ f'{path.fixed}/Adafruit_GenericDevice.cpp',
143
+ f'{path.fixed}/Adafruit_I2CDevice.cpp',
144
+ f'{path.fixed}/Adafruit_SPIDevice.cpp',
145
+ ]
146
+ ) # pylint: disable=E1101
147
+ self.add_include_directories(path.fixed) # pylint: disable=E1101
148
+
149
+ # --------------------
150
+ ## add Wire package files
151
+ # @param _lib unused
152
+ # @return None
153
+ def _add_pkg_wire(self, _lib):
154
+ path = PathHandle(f'{svc.osal.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.7/libraries/Wire/src')
155
+ # built-in package, no installation
156
+ self.add_sources(
157
+ [
158
+ f'{path.fixed}/Wire.cpp',
159
+ f'{path.fixed}/utility/twi.c',
160
+ ]
161
+ )
162
+ self.add_include_directories([path.fixed, f'{path.fixed}/utility']) # pylint: disable=E1101
163
+
164
+ # --------------------
165
+ ## add SPI package files
166
+ # @param _lib unused
167
+ # @return None
168
+ def _add_pkg_spi(self, _lib):
169
+ path = PathHandle(f'{svc.osal.arduino_root_dir()}/packages/arduino/hardware/avr/1.8.7/libraries/SPI/src')
170
+ # built-in package, no installation
171
+ self.add_sources(f'{path.fixed}/SPI.cpp')
172
+ self.add_include_directories(path.fixed) # pylint: disable=E1101
173
+
91
174
  # --------------------
92
175
  ## check if an arduino library is installed
93
176
  #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyalamake
3
- Version: 2.3.0
3
+ Version: 2.3.2
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>
@@ -1,23 +0,0 @@
1
- from dataclasses import dataclass
2
-
3
- from .svc import svc
4
-
5
-
6
- # --------------------
7
- ## info for the OpenGL package
8
- class PackageOpengl:
9
- # --------------------
10
- ## return info about the pkgname
11
- #
12
- # @param pkgname the name of the package; default: opengl
13
- # @return ref to OpenGl info
14
- def find(self, pkgname):
15
- # TODO: check if this works on macos & win/msys2
16
- svc.log.line(f'finding package: {pkgname}')
17
-
18
- @dataclass
19
- class OpenGl:
20
- include_dir = '/usr/include'
21
- link_libs = ['glut', 'GLU', 'GL']
22
-
23
- return OpenGl
File without changes
File without changes
File without changes
File without changes