From: Uwe Hermann Date: Tue, 24 May 2016 19:42:02 +0000 (+0200) Subject: Move common/ directory into decoders/. X-Git-Tag: libsigrokdecode-0.4.1~14 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=47509b17ad9aecd867de76210fb4130bbe78938e;p=libsigrokdecode.git 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. --- 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/srd.c b/srd.c index c74d2de..2947ca8 100644 --- a/srd.c +++ b/srd.c @@ -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')