Skip to content

Commit 2f57090

Browse files
committed
ini: Implement a new ini-file parser and adapt the code to use it.
1 parent 568354c commit 2f57090

File tree

115 files changed

+6693
-3671
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+6693
-3671
lines changed

configs/sim/axis/gladevcp/meter_scale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, halcomp,builder,useropts):
1818
self.max_value.connect('value-changed', self._on_max_value_change)
1919

2020
inifile = linuxcnc.ini(os.getenv("INI_FILE_NAME"))
21-
mmax = float(inifile.find("METER", "MAX") or 100.0)
21+
mmax = inifile.getreal("METER", "MAX", fallback=100.0)
2222
self.meter = self.builder.get_object('meter')
2323
self.max_value.set(mmax)
2424

configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/python/remap.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,17 @@
3939

4040
# set up parsing of the inifile
4141
import os
42-
import configparser
42+
import linuxcnc
4343
# get the path for the ini file used to start this config
4444
inifile = os.environ.get("INI_FILE_NAME")
45-
# instantiate a parser in non-strict mode because we have multiple entries for
46-
# some sections in the ini
47-
config = configparser.ConfigParser(strict=False)
48-
# ingest the ini file
49-
config.read(inifile)
45+
# instantiate the LinuxCNC ini-parser
46+
config = linuxcnc.ini(inifile)
5047

5148
## SPINDLE ROTARY JOINT LETTERS
5249
# spindle primary joint
53-
joint_letter_primary = (config['TWP']['PRIMARY']).capitalize()
50+
joint_letter_primary = config.getstring('TWP', 'PRIMARY', fallback="").capitalize()
5451
# spindle secondary joint (ie the one closer to the tool)
55-
joint_letter_secondary = (config['TWP']['SECONDARY']).capitalize()
52+
joint_letter_secondary = config.getstring('TWP', 'SECONDARY', fallback="").capitalize()
5653

5754
if not joint_letter_primary in ('A','B','C') or not joint_letter_secondary in ('A','B','C'):
5855
log.error("Unable to parse joint letters given in INI [TWP].")
@@ -61,18 +58,18 @@
6158
else:
6259
# get the MIN/MAX limits of the respective rotary joint letters
6360
category = 'AXIS_' + joint_letter_primary
64-
primary_min_limit = float(config[category]['MIN_LIMIT'])
65-
primary_max_limit = float(config[category]['MAX_LIMIT'])
61+
primary_min_limit = config.getreal(category, 'MIN_LIMIT', fallback=0.0)
62+
primary_max_limit = config.getreal(category, 'MAX_LIMIT', fallback=0.0)
6663
log.info('Joint letter for primary is %s with MIN/MAX limits: %s,%s', joint_letter_primary, primary_min_limit, primary_max_limit)
6764
category = 'AXIS_' + joint_letter_secondary
68-
secondary_min_limit = float(config[category]['MIN_LIMIT'])
69-
secondary_max_limit = float(config[category]['MAX_LIMIT'])
65+
secondary_min_limit = config.getreal(category, 'MIN_LIMIT', fallback=0.0)
66+
secondary_max_limit = config.gerreal(category, 'MAX_LIMIT', fallback=0.0)
7067
log.info('Joint letter for secondary is %s with MIN/MAX Limits: %s,%s', joint_letter_secondary, secondary_min_limit, secondary_max_limit)
7168

7269

7370
## CONNECTIONS TO THE KINEMATIC COMPONENT
74-
# get the name of the kinematic component (this seems to ingest also the next line)
75-
kins_comp = (config['KINS']['KINEMATICS']).partition('\n')[0]
71+
# get the name of the kinematic component
72+
kins_comp = config.getstring('KINS', 'KINEMATICS', fallback="")
7673
# name of the hal pin that represents the nutation-angle
7774
kins_nutation_angle = kins_comp + '_kins.nut-angle'
7875
# name of the hal pin that represents the pre-rotation

debian/linuxcnc.install.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ usr/bin/hexagui
3434
usr/bin/hy_gt_vfd
3535
usr/bin/hy_vfd
3636
usr/bin/image-to-gcode
37+
usr/bin/inivalue
3738
usr/bin/inivar
3839
usr/bin/latency-histogram
3940
usr/bin/latency-plot

debian/linuxcnc.lintian-overrides.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ linuxcnc-uspace: elevated-privileges 4755 root/root [usr/bin/linuxcnc_module_hel
99
linuxcnc-uspace: elevated-privileges 4755 root/root [usr/bin/rtapi_app]
1010

1111
# that is intentional - for now
12-
linuxcnc-uspace: package-name-doesnt-match-sonames liblinuxcnchal0 liblinuxcncini0 libnml0 libposemath0 libpyplugin0 librs274-0 libtooldata0
12+
linuxcnc-uspace: package-name-doesnt-match-sonames liblinuxcnchal0 liblinuxcncini1 libnml0 libposemath0 libpyplugin0 librs274-0 libtooldata0
1313

1414
# These are dlopened by rtapi_app, which is already linked against libc.
1515
linuxcnc-uspace: library-not-linked-against-libc [usr/lib/linuxcnc/modules/*.so]

debian/linuxcnc.manpages.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ usr/share/man/man1/hexagui.1
3030
usr/share/man/man1/hy_gt_vfd.1
3131
usr/share/man/man1/hy_vfd.1
3232
usr/share/man/man1/image-to-gcode.1
33+
usr/share/man/man1/inivalue.1
3334
usr/share/man/man1/inivar.1
3435
usr/share/man/man1/io.1
3536
usr/share/man/man1/iocontrol.1

docs/man/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ man1/hexagui.1
3939
man1/hy_gt_vfd.1
4040
man1/hy_vfd.1
4141
man1/image-to-gcode.1
42+
man1/inivalue.1
4243
man1/inivar.1
4344
man1/io.1
4445
man1/iov2.1

docs/po4a.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
[type: AsciiDoc_def] src/man/man1/hy_gt_vfd.1.adoc $lang:src/$lang/man/man1/hy_gt_vfd.1.adoc
178178
[type: AsciiDoc_def] src/man/man1/hy_vfd.1.adoc $lang:src/$lang/man/man1/hy_vfd.1.adoc
179179
[type: AsciiDoc_def] src/man/man1/image-to-gcode.1.adoc $lang:src/$lang/man/man1/image-to-gcode.1.adoc
180+
[type: AsciiDoc_def] src/man/man1/inivalue.1.adoc $lang:src/$lang/man/man1/inivalue.1.adoc
180181
[type: AsciiDoc_def] src/man/man1/inivar.1.adoc $lang:src/$lang/man/man1/inivar.1.adoc
181182
[type: AsciiDoc_def] src/man/man1/io.1.adoc $lang:src/$lang/man/man1/io.1.adoc
182183
[type: AsciiDoc_def] src/man/man1/latency-histogram.1.adoc $lang:src/$lang/man/man1/latency-histogram.1.adoc

0 commit comments

Comments
 (0)