U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 13/19] fdt: Stop building the old python libfdt module
Date: Sun, 16 Apr 2017 20:22:27 -0600	[thread overview]
Message-ID: <20170417022233.28101-14-sjg@chromium.org> (raw)
In-Reply-To: <20170417022233.28101-1-sjg@chromium.org>

This is no-longer needed, so stop building it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 lib/libfdt/libfdt_legacy.swig | 112 ------------------------------------------
 lib/libfdt/setup.py           |  38 --------------
 tools/Makefile                |  18 -------
 3 files changed, 168 deletions(-)
 delete mode 100644 lib/libfdt/libfdt_legacy.swig
 delete mode 100644 lib/libfdt/setup.py

diff --git a/lib/libfdt/libfdt_legacy.swig b/lib/libfdt/libfdt_legacy.swig
deleted file mode 100644
index 9880dd998e..0000000000
--- a/lib/libfdt/libfdt_legacy.swig
+++ /dev/null
@@ -1,112 +0,0 @@
-%module libfdt_legacy
-
-%{
-#define SWIG_FILE_WITH_INIT
-#include "libfdt.h"
-%}
-
-%pythoncode %{
-def Raise(errnum):
-    raise ValueError('Error %s' % fdt_strerror(errnum))
-
-def Name(fdt, offset):
-    name, len = fdt_get_name(fdt, offset)
-    return name
-
-def String(fdt, offset):
-    offset = fdt32_to_cpu(offset)
-    name = fdt_string(fdt, offset)
-    return name
-
-def swap32(x):
-    return (((x << 24) & 0xFF000000) |
-            ((x <<  8) & 0x00FF0000) |
-            ((x >>  8) & 0x0000FF00) |
-            ((x >> 24) & 0x000000FF))
-
-def fdt32_to_cpu(x):
-    return swap32(x)
-
-def Data(prop):
-    set_prop(prop)
-    return get_prop_data()
-%}
-
-%include "typemaps.i"
-%include "cstring.i"
-
-%typemap(in) void* = char*;
-
-typedef int fdt32_t;
-
-struct fdt_property {
-        fdt32_t tag;
-        fdt32_t len;
-        fdt32_t nameoff;
-        char data[0];
-};
-
-/*
- * This is a work-around since I'm not sure of a better way to copy out the
- * contents of a string. This is used in dtoc/GetProps(). The intent is to
- * pass in a pointer to a property and access the data field at the end of
- * it. Ideally the Data() function above would be able to do this directly,
- * but I'm not sure how to do that.
- */
-#pragma SWIG nowarn=454
-%inline %{
-    static struct fdt_property *cur_prop;
-
-    void set_prop(struct fdt_property *prop) {
-        cur_prop = prop;
-    }
-%}
-
-%cstring_output_allocate_size(char **s, int *sz, free(*$1));
-%inline %{
-    void get_prop_data(char **s, int *sz) {
-        *sz = fdt32_to_cpu(cur_prop->len);
-        *s = (char *)malloc(*sz);
-        if (!*s)
-            *sz = 0;
-        else
-            memcpy(*s, cur_prop + 1, *sz);
-    }
-%}
-
-%typemap(in) (const void *) {
-  if (!PyByteArray_Check($input)) {
-    SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument "
-                       "$argnum"" of type '" "$type""'");
-  }
-  $1 = (void *) PyByteArray_AsString($input);
-}
-
-const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
-int fdt_path_offset(const void *fdt, const char *path);
-int fdt_first_property_offset(const void *fdt, int nodeoffset);
-int fdt_next_property_offset(const void *fdt, int offset);
-const char *fdt_strerror(int errval);
-const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
-                                                      int offset,
-                                                      int *OUTPUT);
-const char *fdt_get_name(const void *fdt, int nodeoffset, int *OUTPUT);
-const char *fdt_string(const void *fdt, int stroffset);
-int fdt_first_subnode(const void *fdt, int offset);
-int fdt_next_subnode(const void *fdt, int offset);
-
-%typemap(in) (void *) {
-  if (!PyByteArray_Check($input)) {
-    SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument "
-                       "$argnum"" of type '" "$type""'");
-  }
-  $1 = PyByteArray_AsString($input);
-}
-
-int fdt_delprop(void *fdt, int nodeoffset, const char *name);
-
-const char *fdt_strerror(int errval);
-int fdt_pack(void *fdt);
-
-int fdt_totalsize(const void *fdt);
-int fdt_off_dt_struct(const void *fdt);
diff --git a/lib/libfdt/setup.py b/lib/libfdt/setup.py
deleted file mode 100644
index fc881351c6..0000000000
--- a/lib/libfdt/setup.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-"""
-setup.py file for SWIG libfdt
-"""
-
-from distutils.core import setup, Extension
-import os
-import sys
-
-# Don't cross-compile - always use the host compiler.
-del os.environ['CROSS_COMPILE']
-del os.environ['CC']
-
-progname = sys.argv[0]
-cflags = sys.argv[1]
-files = sys.argv[2:]
-
-if cflags:
-    cflags = [flag for flag in cflags.split(' ') if flag]
-else:
-    cflags = None
-
-libfdt_module = Extension(
-    '_libfdt_legacy',
-    sources = files,
-    extra_compile_args =  cflags
-)
-
-sys.argv = [progname, '--quiet', 'build_ext', '--inplace', '--force']
-
-setup (name = 'libfdt_legaacy',
-       version = '0.1',
-       author      = "SWIG Docs",
-       description = """Simple swig libfdt from docs""",
-       ext_modules = [libfdt_module],
-       py_modules = ["libfdt_legacy"],
-       )
diff --git a/tools/Makefile b/tools/Makefile
index 3ffd3eeca9..fb91b5247b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -130,24 +130,6 @@ tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG)
 	mv $(libfdt_tree)/pylibfdt/libfdt.py tools/.
 	rm $(libfdt_tree)/pylibfdt/libfdt_wrap.c
 
-# Build a libfdt Python module if swig is available
-# Use 'sudo apt-get install swig libpython-dev' to enable this
-hostprogs-y += \
-	$(if $(shell which swig 2> /dev/null),_libfdt_legacy.so)
-_libfdt_legacy.so-sharedobjs += $(LIBFDT_OBJS)
-libfdt:
-
-tools/_libfdt_legacy.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) \
-		tools/libfdt_legacy_wrap.c
-	LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= ${PYTHON} $(srctree)/lib/libfdt/setup.py \
-		"$(_hostc_flags)" $^
-	mv _libfdt_legacy.so $@
-
-tools/libfdt_legacy_wrap.c: $(srctree)/lib/libfdt/libfdt_legacy.swig
-	swig -python -o $@ $<
-
-# TODO(sjg@chromium.org): Is this correct on Mac OS?
-
 ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
 # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
 # the mxsimage support within tools/mxsimage.c .
-- 
2.12.2.762.g0e3151a226-goog

  parent reply	other threads:[~2017-04-17  2:22 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-17  2:22 [U-Boot] [PATCH 00/19] fdt: Move to the new upstream pylibfdt library Simon Glass
2017-04-17  2:22 ` [U-Boot] [PATCH 01/19] pci: Correct cast for sandbox Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 02/19] fdt: Correct cast for sandbox in fdtdec_setup_memory_size() Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 03/19] fdt: Use SPDX format for licenses in the libfdt headers Simon Glass
2017-04-17 13:05   ` Tom Rini
2017-04-17 13:13     ` Masahiro Yamada
2017-04-17 13:33       ` Tom Rini
2017-04-17 13:47         ` Simon Glass
2017-04-17 14:01           ` Tom Rini
2017-05-02 11:27             ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 04/19] fdt: Move header files into lib/libfdt Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 05/19] fdt: Allow swig options to be provided by Makefile Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 06/19] fdt: Add all source files to the libfdt build Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 07/19] fdt: Rename existing python libfdt module Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 08/19] fdt: Build the new " Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 09/19] fdt: Update fdt_test to use 'dt' instead of 'fdt' Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 10/19] fdt: dtoc: Add a full set of property tests Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 11/19] fdt: Support use of the new python libfdt library Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 12/19] fdt: Makefile: Build python libfdt library if needed Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` Simon Glass [this message]
2017-05-02 11:27   ` [U-Boot] [PATCH 13/19] fdt: Stop building the old python libfdt module sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 14/19] fdt: Drop use of the legacy libfdt python module Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 15/19] fdt: Drop fdt_fallback library Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 16/19] binman: Drop a special case related to fdt_fallback Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 17/19] fdt: Merge fdt_normal with its base class Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 18/19] binman: Rename fdt variable to dtb Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-17  2:22 ` [U-Boot] [PATCH 19/19] fdt: Drop fdt_select.py Simon Glass
2017-05-02 11:27   ` sjg at google.com
2017-04-18 16:25 ` [U-Boot] [PATCH 00/19] fdt: Move to the new upstream pylibfdt library Tom Rini
2017-04-18 16:27   ` Simon Glass
2017-04-18 16:33     ` Tom Rini
2017-04-18 16:48       ` Simon Glass
2017-04-19 14:27         ` Tom Rini
2017-05-02 11:31           ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170417022233.28101-14-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox