Added support for locale's decimal point.

This commit is contained in:
SET 2020-08-13 13:11:27 -03:00
parent bfc6e07481
commit b50aaf7806
2 changed files with 8 additions and 2 deletions

View File

@ -47,6 +47,7 @@ __status__ = 'beta'
import os
import sys
import gzip
import locale
from glob import glob
from logging import DEBUG
@ -163,6 +164,7 @@ def solve_board_file(schematic, a_board_file):
def main():
locale.setlocale(locale.LC_ALL, '')
ver = 'KiPlot '+__version__+' - '+__copyright__+' - License: '+__license__
args = docopt(__doc__, version=ver, options_first=True)

View File

@ -100,9 +100,13 @@ def comp_match(component):
original = component
# Convert the decimal point from the current locale to a '.'
global decimal_point
if not decimal_point:
if decimal_point is None:
decimal_point = locale.localeconv()['decimal_point']
if decimal_point and decimal_point != '.':
logger.debug('Decimal point `{}`'.format(decimal_point))
# Avoid conversions for '.'
if decimal_point == '.':
decimal_point = ''
if decimal_point:
component = component.replace(decimal_point, ".")
# Remove any commas