diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2016-05-24 21:42:02 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2016-05-25 15:14:23 +0200 |
commit | 135b790c851c52400279e7c932e1f900d91ae5cc (patch) | |
tree | c3bd5bc677c8e66044853bddc0e96cbdcfa2c376 | |
parent | ae2181cd35e84ce81cfe58d2e0e05fdb3dfcb263 (diff) | |
download | libsigrokdecode-135b790c851c52400279e7c932e1f900d91ae5cc.tar.gz libsigrokdecode-135b790c851c52400279e7c932e1f900d91ae5cc.zip |
Move common/ directory into decoders/.
This simplifies cross-platform handling of the Python/decoder paths
and module installation/dist a bit and also fixes bug #804.
-rw-r--r-- | Makefile.am | 11 | ||||
-rw-r--r-- | decoders/common/__init__.py | 20 | ||||
-rw-r--r-- | decoders/common/plugtrx/__init__.py (renamed from common/plugtrx/__init__.py) | 0 | ||||
-rw-r--r-- | decoders/common/plugtrx/mod.py (renamed from common/plugtrx/mod.py) | 0 | ||||
-rw-r--r-- | decoders/common/sdcard/__init__.py (renamed from common/sdcard/__init__.py) | 0 | ||||
-rw-r--r-- | decoders/common/sdcard/mod.py (renamed from common/sdcard/mod.py) | 0 | ||||
-rw-r--r-- | decoders/common/srdhelper/__init__.py (renamed from common/srdhelper/__init__.py) | 0 | ||||
-rw-r--r-- | decoders/common/srdhelper/mod.py (renamed from common/srdhelper/mod.py) | 0 | ||||
-rw-r--r-- | decoders/dcf77/pd.py | 2 | ||||
-rw-r--r-- | decoders/ds1307/pd.py | 2 | ||||
-rw-r--r-- | decoders/rtc8564/pd.py | 2 | ||||
-rw-r--r-- | decoders/sdcard_sd/pd.py | 2 | ||||
-rw-r--r-- | decoders/sdcard_spi/pd.py | 2 | ||||
-rw-r--r-- | decoders/xfp/pd.py | 2 | ||||
-rw-r--r-- | srd.c | 6 | ||||
-rwxr-xr-x | tools/install-decoders | 10 |
16 files changed, 34 insertions, 25 deletions
diff --git a/Makefile.am b/Makefile.am index 1a1074e..a8df8f6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,12 +23,11 @@ AM_LIBTOOLFLAGS = --silent GNUMAKEFLAGS = --no-print-directory DECODERS_DIR = $(pkgdatadir)/decoders -COMMON_DIR = $(pkgdatadir)/common # Do not hard-code the decoders location on Windows. if WIN32 AM_CPPFLAGS = else -AM_CPPFLAGS = -DDECODERS_DIR='"$(DECODERS_DIR)"' -DCOMMON_DIR='"$(COMMON_DIR)"' +AM_CPPFLAGS = -DDECODERS_DIR='"$(DECODERS_DIR)"' endif # The tests CFLAGS are a superset of the libsigrokdecode CFLAGS. @@ -89,20 +88,14 @@ ChangeLog: dist-hook: ChangeLog $(MKDIR_P) $(distdir)/tools cp ${top_srcdir}/tools/install-decoders $(distdir)/tools - $(MKDIR_P) $(distdir)/common - cp -a ${top_srcdir}/common $(distdir) $(MKDIR_P) $(distdir)/decoders ${top_srcdir}/tools/install-decoders -i ${top_srcdir}/decoders \ -o $(distdir)/decoders -install-common: - $(MKDIR_P) $(DESTDIR)$(COMMON_DIR) - cp -a ${top_srcdir}/common $(DESTDIR)$(pkgdatadir) - install-decoders: $(MKDIR_P) $(DESTDIR)$(DECODERS_DIR) $(PYTHON3) ${top_srcdir}/tools/install-decoders \ -i ${top_srcdir}/decoders -o $(DESTDIR)$(DECODERS_DIR) -install-data-hook: install-common install-decoders +install-data-hook: install-decoders diff --git a/decoders/common/__init__.py b/decoders/common/__init__.py new file mode 100644 index 0000000..c597431 --- /dev/null +++ b/decoders/common/__init__.py @@ -0,0 +1,20 @@ +## +## This file is part of the libsigrokdecode project. +## +## Copyright (C) 2016 Uwe Hermann <uwe@hermann-uwe.de> +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + diff --git a/common/plugtrx/__init__.py b/decoders/common/plugtrx/__init__.py index 8dd0822..8dd0822 100644 --- a/common/plugtrx/__init__.py +++ b/decoders/common/plugtrx/__init__.py diff --git a/common/plugtrx/mod.py b/decoders/common/plugtrx/mod.py index 3d1b66d..3d1b66d 100644 --- a/common/plugtrx/mod.py +++ b/decoders/common/plugtrx/mod.py diff --git a/common/sdcard/__init__.py b/decoders/common/sdcard/__init__.py index cf09d9d..cf09d9d 100644 --- a/common/sdcard/__init__.py +++ b/decoders/common/sdcard/__init__.py diff --git a/common/sdcard/mod.py b/decoders/common/sdcard/mod.py index f553cf1..f553cf1 100644 --- a/common/sdcard/mod.py +++ b/decoders/common/sdcard/mod.py diff --git a/common/srdhelper/__init__.py b/decoders/common/srdhelper/__init__.py index cf09d9d..cf09d9d 100644 --- a/common/srdhelper/__init__.py +++ b/decoders/common/srdhelper/__init__.py diff --git a/common/srdhelper/mod.py b/decoders/common/srdhelper/mod.py index e65ab17..e65ab17 100644 --- a/common/srdhelper/mod.py +++ b/decoders/common/srdhelper/mod.py diff --git a/decoders/dcf77/pd.py b/decoders/dcf77/pd.py index 4f956aa..0f1d3d1 100644 --- a/decoders/dcf77/pd.py +++ b/decoders/dcf77/pd.py @@ -20,7 +20,7 @@ import sigrokdecode as srd import calendar -from srdhelper import bcd2int +from common.srdhelper import bcd2int class SamplerateError(Exception): pass diff --git a/decoders/ds1307/pd.py b/decoders/ds1307/pd.py index 6d862af..f181fd9 100644 --- a/decoders/ds1307/pd.py +++ b/decoders/ds1307/pd.py @@ -21,7 +21,7 @@ import re import sigrokdecode as srd -from srdhelper import bcd2int +from common.srdhelper import bcd2int days_of_week = ( 'Sunday', 'Monday', 'Tuesday', 'Wednesday', diff --git a/decoders/rtc8564/pd.py b/decoders/rtc8564/pd.py index 4bcd096..4ecc15a 100644 --- a/decoders/rtc8564/pd.py +++ b/decoders/rtc8564/pd.py @@ -19,7 +19,7 @@ ## import sigrokdecode as srd -from srdhelper import bcd2int +from common.srdhelper import bcd2int def reg_list(): l = [] diff --git a/decoders/sdcard_sd/pd.py b/decoders/sdcard_sd/pd.py index 442a563..79c2074 100644 --- a/decoders/sdcard_sd/pd.py +++ b/decoders/sdcard_sd/pd.py @@ -19,7 +19,7 @@ ## import sigrokdecode as srd -from sdcard import (cmd_names, acmd_names, accepted_voltages, card_status, sd_status) +from common.sdcard import (cmd_names, acmd_names, accepted_voltages, card_status, sd_status) class Decoder(srd.Decoder): api_version = 2 diff --git a/decoders/sdcard_spi/pd.py b/decoders/sdcard_spi/pd.py index e069b6e..45490ad 100644 --- a/decoders/sdcard_spi/pd.py +++ b/decoders/sdcard_spi/pd.py @@ -19,7 +19,7 @@ ## import sigrokdecode as srd -from sdcard import (cmd_names, acmd_names) +from common.sdcard import (cmd_names, acmd_names) class Decoder(srd.Decoder): api_version = 2 diff --git a/decoders/xfp/pd.py b/decoders/xfp/pd.py index 26f3311..27135e5 100644 --- a/decoders/xfp/pd.py +++ b/decoders/xfp/pd.py @@ -18,7 +18,7 @@ ## import sigrokdecode as srd -from plugtrx import (MODULE_ID, ALARM_THRESHOLDS, AD_READOUTS, GCS_BITS, +from common.plugtrx import (MODULE_ID, ALARM_THRESHOLDS, AD_READOUTS, GCS_BITS, CONNECTOR, TRANSCEIVER, SERIAL_ENCODING, XMIT_TECH, CDR, DEVICE_TECH, ENHANCED_OPTS, AUX_TYPES) @@ -169,12 +169,6 @@ SRD_API int srd_init(const char *path) } } #ifdef DECODERS_DIR - /* Common modules for use by any decoder. */ - if ((ret = srd_decoder_searchpath_add(COMMON_DIR)) != SRD_OK) { - Py_Finalize(); - return ret; - } - /* Hardcoded decoders install location, if defined. */ if ((ret = srd_decoder_searchpath_add(DECODERS_DIR)) != SRD_OK) { Py_Finalize(); diff --git a/tools/install-decoders b/tools/install-decoders index 465c70e..8445da5 100755 --- a/tools/install-decoders +++ b/tools/install-decoders @@ -24,7 +24,7 @@ from shutil import copy from getopt import getopt -def install(srcdir, dstdir): +def install(srcdir, dstdir, s): worklist = [] for pd in os.listdir(srcdir): pd_dir = srcdir + '/' + pd @@ -39,9 +39,10 @@ def install(srcdir, dstdir): install_list.extend(config_get_extra_install(pd_file)) elif f[-3:] == '.py': install_list.append(f) - worklist.append((pd, pd_dir, install_list)) + if install_list: + worklist.append((pd, pd_dir, install_list)) - print("Installing %d protocol decoders:" % len(worklist)) + print("Installing %d %s:" % (len(worklist), s)) col = 0 for pd, pd_dir, install_list in worklist: msg = pd + ' ' @@ -107,6 +108,7 @@ except Exception as e: if len(args) != 0 or dst is None: usage() -install(src, dst) +install(src, dst, 'protocol decoders') +install(src + '/common', dst + '/common', 'common modules') |