Skip to contentSkip to conversation

i2c-tools: add hash file

PATCH Superseded Ryan Barnett 2 participants 6 messages Apr 5, 2015

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 i2c-tools: add hash file

---
 package/i2c-tools/i2c-tools.hash | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 package/i2c-tools/i2c-tools.hash
package/i2c-tools/i2c-tools.hash new file +2 -0
new file mode 100644
index 0000000..a6c376f
@@ -0,0 +1,2 @@
+# locally computed hash
+sha256	14d4d7d60d1c12e43f2befe239c682a5c44c27682f153d4b58c1e392d2db1700  i2c-tools-3.1.1.tar.bz2
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 2/2 i2c-tools: add support to build python extension

Add a config option to build the python bindings for i2c-tools - py-smbus. The steps for building the python bindings is the same as the distutil steps that are a part of the python infrastructure.

CC Tjeerd Pinkert <[email protected]>
CC Zoltan Gyarmati <[email protected]>
CC Thomas Petazzoni <[email protected]>
CC Baruch Siach <[email protected]>

---
Changes v1 -> v2:
- Fixed spelling in config entry
- Utilize the python infrastructure variables for environment and build/install opts (suggested by Thomas P)
- Only support python2.7 since this is not compatabile with python3 (suggested by Baruch)

---
 package/i2c-tools/Config.in    | 13 +++++++++++++
 package/i2c-tools/i2c-tools.mk | 27 +++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
package/i2c-tools/Config.in +13 -0
index e83dbd6..6426f30 100644
@@ -8,3 +8,16 @@ config BR2_PACKAGE_I2C_TOOLS
 	  EEPROM decoding scripts, and more.
 
 	  http://www.lm-sensors.org/wiki/I2CTools
+
+if BR2_PACKAGE_I2C_TOOLS
+
+config BR2_PACKAGE_I2C_TOOLS_PYSMBUS
+	bool "py-smbus"
+	depends on BR2_PACKAGE_PYTHON
+	help
+	  Python bindings to smbus from the i2c-tools package.
+
+comment "i2c-tools py-smbus depends on python2"
+	depends on !BR2_PACKAGE_PYTHON
+
+endif
package/i2c-tools/i2c-tools.mk +27 -0
index 0115e22..ec2995f 100644
@@ -21,4 +21,31 @@ define I2C_TOOLS_INSTALL_TARGET_CMDS
 	done
 endef
 
+# BASE_ENV taken from PKG_PYTHON_DISTUTILS_ENV in package/pkg-python.mk
+I2C_TOOLS_PYTHON_BASE_ENV = \
+	$(PKG_PYTHON_DISTUTILS_ENV) \
+	CFLAGS="$(TARGET_CFLAGS) -I../include"
+
+# Build/install steps mirror the distutil python package type in the python package
+# infrastructure
+ifeq ($(BR2_PACKAGE_I2C_TOOLS_PYSMBUS),y)
+I2C_TOOLS_DEPENDENCIES += python
+
+define I2C_TOOLS_BUILD_PYSMBUS
+	(cd $(@D)/py-smbus;  \
+	$(I2C_TOOLS_PYTHON_BASE_ENV) \
+		$(HOST_DIR)/usr/bin/python setup.py build \
+		$(PKG_PYTHON_DISTUTILS_BUILD_OPTS))
+endef
+I2C_TOOLS_POST_BUILD_HOOKS += I2C_TOOLS_BUILD_PYSMBUS
+
+define I2C_TOOLS_INSTALL_PYSMBUS
+	(cd $(@D)/py-smbus; \
+	$(I2C_TOOLS_PYTHON_BASE_ENV) \
+		$(HOST_DIR)/usr/bin/python setup.py install \
+		$(PKG_PYTHON_DISTUTILS_INSTALL_TARGET_OPTS))
+endef
+I2C_TOOLS_POST_INSTALL_TARGET_HOOKS += I2C_TOOLS_INSTALL_PYSMBUS
+endif
+
 $(eval $(generic-package))
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/2 i2c-tools: add support to build python extension

Ryan, All,

On 2015-04-05 14:48 -0500, Ryan Barnett spake thusly:

Quoted 28 lines

Add a config option to build the python bindings for i2c-tools - py-smbus. The steps for building the python bindings is the same as the distutil steps that are a part of the python infrastructure.

CC Tjeerd Pinkert <[email protected]>
CC Zoltan Gyarmati <[email protected]>
CC Thomas Petazzoni <[email protected]>
CC Baruch Siach <[email protected]>

---
Changes v1 -> v2:
- Fixed spelling in config entry
- Utilize the python infrastructure variables for environment and build/install opts (suggested by Thomas P)
- Only support python2.7 since this is not compatabile with python3 (suggested by Baruch)

---
 package/i2c-tools/Config.in    | 13 +++++++++++++
 package/i2c-tools/i2c-tools.mk | 27 +++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
package/i2c-tools/Config.in +0 -0
index e83dbd6..6426f30 100644
@@ -8,3 +8,16 @@ config BR2_PACKAGE_I2C_TOOLS
 	  EEPROM decoding scripts, and more.

package/i2c-tools/Config.in config BR2_PACKAGE_I2C_TOOLS · line 18

Quoted 10 lines
package/i2c-tools/Config.in +8 -0
 
 	  http://www.lm-sensors.org/wiki/I2CTools
+
+if BR2_PACKAGE_I2C_TOOLS
+
+config BR2_PACKAGE_I2C_TOOLS_PYSMBUS
+	bool "py-smbus"
+	depends on BR2_PACKAGE_PYTHON
+	help
+	  Python bindings to smbus from the i2c-tools package.

Well, like Baruch said, I would not add such option, and just build the Python binding if Python is enabled.

Quoted 9 lines
package/i2c-tools/Config.in +4 -0
+comment "i2c-tools py-smbus depends on python2"
+	depends on !BR2_PACKAGE_PYTHON
+
+endif
package/i2c-tools/i2c-tools.mk +0 -0
index 0115e22..ec2995f 100644

package/i2c-tools/i2c-tools.mk define I2C_TOOLS_INSTALL_TARGET_CMDS · line 27

Quoted 7 lines
package/i2c-tools/i2c-tools.mk +4 -0
@@ -21,4 +21,31 @@ define I2C_TOOLS_INSTALL_TARGET_CMDS
 	done
 endef
 
+# BASE_ENV taken from PKG_PYTHON_DISTUTILS_ENV in package/pkg-python.mk
+I2C_TOOLS_PYTHON_BASE_ENV = \
+	$(PKG_PYTHON_DISTUTILS_ENV) \
+	CFLAGS="$(TARGET_CFLAGS) -I../include"

Move this define into the conditional, below.

package/i2c-tools/i2c-tools.mk define I2C_TOOLS_INSTALL_TARGET_CMDS · line 31

Quoted 3 lines
package/i2c-tools/i2c-tools.mk +3 -0
+# Build/install steps mirror the distutil python package type in the python package
+# infrastructure
+ifeq ($(BR2_PACKAGE_I2C_TOOLS_PYSMBUS),y)

Since you'd no longer have an option to enable py-smbus, that conditional would become:

    ifeq ($(BR2_PACKAGE_PYTHON),y)

Also, empty line after the ifeq.

package/i2c-tools/i2c-tools.mk define I2C_TOOLS_INSTALL_TARGET_CMDS · line 40

Quoted 9 lines
package/i2c-tools/i2c-tools.mk +9 -0
+I2C_TOOLS_DEPENDENCIES += python
+
+define I2C_TOOLS_BUILD_PYSMBUS
+	(cd $(@D)/py-smbus;  \
+	$(I2C_TOOLS_PYTHON_BASE_ENV) \
+		$(HOST_DIR)/usr/bin/python setup.py build \
+		$(PKG_PYTHON_DISTUTILS_BUILD_OPTS))
+endef
+I2C_TOOLS_POST_BUILD_HOOKS += I2C_TOOLS_BUILD_PYSMBUS

I'd keep the define, ditch the hook, and shoehorn the macro directly into the build commands, since this is a generic package:

    define I2C_TOOLS_BUILD_CMDS
        $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
        $(I2C_TOOLS_BUILD_PYSMBUS)
    endef

package/i2c-tools/i2c-tools.mk define I2C_TOOLS_INSTALL_TARGET_CMDS · line 48

Quoted 7 lines
package/i2c-tools/i2c-tools.mk +7 -0
+define I2C_TOOLS_INSTALL_PYSMBUS
+	(cd $(@D)/py-smbus; \
+	$(I2C_TOOLS_PYTHON_BASE_ENV) \
+		$(HOST_DIR)/usr/bin/python setup.py install \
+		$(PKG_PYTHON_DISTUTILS_INSTALL_TARGET_OPTS))
+endef
+I2C_TOOLS_POST_INSTALL_TARGET_HOOKS += I2C_TOOLS_INSTALL_PYSMBUS

Ditto, include that directly in the install commands.

package/i2c-tools/i2c-tools.mk define I2C_TOOLS_INSTALL_TARGET_CMDS · line 47

Quoted 1 line
package/i2c-tools/i2c-tools.mk +1 -0
+endif

I like it when there is a comment after the endif, refering to the corresponding ifeq:

endif # BR2_PACKAGE_PYTHON

This helps when the conditional block if more than a few lines long.

Also, empty line before the endif.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v2 2/2 i2c-tools: add support to build python extension

Yann/Baruch,

Quoted 32 lines · Yann E. MORIN

Ryan, All,

On 2015-04-05 14:48 -0500, Ryan Barnett spake thusly:

Quoted 29 lines

Add a config option to build the python bindings for i2c-tools - py-smbus. The steps for building the python bindings is the same as the distutil steps that are a part of the python infrastructure.

CC Tjeerd Pinkert <[email protected]>
CC Zoltan Gyarmati <[email protected]>
CC Thomas Petazzoni <[email protected]>
CC Baruch Siach <[email protected]>

---
Changes v1 -> v2:
- Fixed spelling in config entry
- Utilize the python infrastructure variables for environment and build/install opts (suggested by Thomas P)
- Only support python2.7 since this is not compatabile with python3 (suggested by Baruch)

---
 package/i2c-tools/Config.in    | 13 +++++++++++++
 package/i2c-tools/i2c-tools.mk | 27 +++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
package/i2c-tools/Config.in +0 -0
index e83dbd6..6426f30 100644
@@ -8,3 +8,16 @@ config BR2_PACKAGE_I2C_TOOLS
        EEPROM decoding scripts, and more.
 
Quoted 12 lines

package/i2c-tools/Config.in config BR2_PACKAGE_I2C_TOOLS · line 18

Quoted 9 lines
package/i2c-tools/Config.in +8 -0
        http://www.lm-sensors.org/wiki/I2CTools
+
+if BR2_PACKAGE_I2C_TOOLS
+
+config BR2_PACKAGE_I2C_TOOLS_PYSMBUS
+     bool "py-smbus"
+     depends on BR2_PACKAGE_PYTHON
+     help
+       Python bindings to smbus from the i2c-tools package.

Well, like Baruch said, I would not add such option, and just build the Python binding if Python is enabled.

I kept it for this version because as I have said on IRC - I didn't even know there were python bindings available for i2c-tools since their wiki site makes no mention of this. However, since now more than one person would prefer this, I will change it so the python bindings are automatically installed.

I would like to have some sort of notification about this in the configurator but I don't really like having a comment for this. Plus I have spent more time on this feature than I would have liked so I will not modify Config.in at all.

Quoted 13 lines

package/i2c-tools/Config.in config BR2_PACKAGE_I2C_TOOLS

Quoted 9 lines
package/i2c-tools/Config.in +9 -0
+I2C_TOOLS_DEPENDENCIES += python
+
+define I2C_TOOLS_BUILD_PYSMBUS
+     (cd $(@D)/py-smbus;  \
+     $(I2C_TOOLS_PYTHON_BASE_ENV) \
+             $(HOST_DIR)/usr/bin/python setup.py build \
+             $(PKG_PYTHON_DISTUTILS_BUILD_OPTS))
+endef
+I2C_TOOLS_POST_BUILD_HOOKS += I2C_TOOLS_BUILD_PYSMBUS

I'd keep the define, ditch the hook, and shoehorn the macro directly into the build commands, since this is a generic package:

Quoted 4 lines
    define I2C_TOOLS_BUILD_CMDS
        $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
        $(I2C_TOOLS_BUILD_PYSMBUS)
    endef

OK I will do this since when you put it that way I prefer this too. However, it isn't really clear that you are suppose to do something like this from the manual as I debated this issue. To use hooks or not to use hooks, that is the question... :)

Quoted 12 lines

package/i2c-tools/Config.in

Quoted 7 lines
package/i2c-tools/Config.in +7 -0
+define I2C_TOOLS_INSTALL_PYSMBUS
+     (cd $(@D)/py-smbus; \
+     $(I2C_TOOLS_PYTHON_BASE_ENV) \
+             $(HOST_DIR)/usr/bin/python setup.py install \
+             $(PKG_PYTHON_DISTUTILS_INSTALL_TARGET_OPTS))
+endef
+I2C_TOOLS_POST_INSTALL_TARGET_HOOKS += I2C_TOOLS_INSTALL_PYSMBUS

Ditto, include that directly in the install commands.

Quoted 1 line

+endif

Quoted 8 lines

I like it when there is a comment after the endif, refering to the corresponding ifeq:

endif # BR2_PACKAGE_PYTHON

This helps when the conditional block if more than a few lines long.

Also, empty line before the endif.

Will do as I do like the readability of this too.

Thanks,
-Ryan

#4 lore raw

PATCH v2 2/2 i2c-tools: add support to build python extension

Ryan, All,

On 2015-04-05 16:33 -0500, Ryan Barnett spake thusly:

Quoted 52 lines · Yann E. MORIN
Quoted 32 lines

Ryan, All,

On 2015-04-05 14:48 -0500, Ryan Barnett spake thusly:

Quoted 29 lines

Add a config option to build the python bindings for i2c-tools - py-smbus. The steps for building the python bindings is the same as the distutil steps that are a part of the python infrastructure.

CC Tjeerd Pinkert <[email protected]>
CC Zoltan Gyarmati <[email protected]>
CC Thomas Petazzoni <[email protected]>
CC Baruch Siach <[email protected]>

---
Changes v1 -> v2:
- Fixed spelling in config entry
- Utilize the python infrastructure variables for environment and build/install opts (suggested by Thomas P)
- Only support python2.7 since this is not compatabile with python3 (suggested by Baruch)

---
 package/i2c-tools/Config.in    | 13 +++++++++++++
 package/i2c-tools/i2c-tools.mk | 27 +++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
package/i2c-tools/Config.in +0 -0
index e83dbd6..6426f30 100644
@@ -8,3 +8,16 @@ config BR2_PACKAGE_I2C_TOOLS
        EEPROM decoding scripts, and more.
 
Quoted 12 lines

package/i2c-tools/Config.in config BR2_PACKAGE_I2C_TOOLS · line 18

Quoted 9 lines
package/i2c-tools/Config.in +8 -0
        http://www.lm-sensors.org/wiki/I2CTools
+
+if BR2_PACKAGE_I2C_TOOLS
+
+config BR2_PACKAGE_I2C_TOOLS_PYSMBUS
+     bool "py-smbus"
+     depends on BR2_PACKAGE_PYTHON
+     help
+       Python bindings to smbus from the i2c-tools package.

Well, like Baruch said, I would not add such option, and just build the Python binding if Python is enabled.

I kept it for this version because as I have said on IRC - I didn't even know there were python bindings available for i2c-tools since their wiki site makes no mention of this. However, since now more than one person would prefer this, I will change it so the python bindings are automatically installed.

Quoted 4 lines

I would like to have some sort of notification about this in the configurator but I don't really like having a comment for this. Plus I have spent more time on this feature than I would have liked so I will not modify Config.in at all.

OK, that's fine with me that you don't want to go any further with that.

An interested party can get the patch and resubmit with the change later on.

Quoted 18 lines
Quoted 13 lines

package/i2c-tools/Config.in config BR2_PACKAGE_I2C_TOOLS

Quoted 9 lines
package/i2c-tools/Config.in +9 -0
+I2C_TOOLS_DEPENDENCIES += python
+
+define I2C_TOOLS_BUILD_PYSMBUS
+     (cd $(@D)/py-smbus;  \
+     $(I2C_TOOLS_PYTHON_BASE_ENV) \
+             $(HOST_DIR)/usr/bin/python setup.py build \
+             $(PKG_PYTHON_DISTUTILS_BUILD_OPTS))
+endef
+I2C_TOOLS_POST_BUILD_HOOKS += I2C_TOOLS_BUILD_PYSMBUS

I'd keep the define, ditch the hook, and shoehorn the macro directly into the build commands, since this is a generic package:

Quoted 4 lines
    define I2C_TOOLS_BUILD_CMDS
        $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
        $(I2C_TOOLS_BUILD_PYSMBUS)
    endef
Quoted 4 lines

OK I will do this since when you put it that way I prefer this too. However, it isn't really clear that you are suppose to do something like this from the manual as I debated this issue. To use hooks or not to use hooks, that is the question... :)

Well, for generic packages, there's no much point in using hooks to start with, since you handle commands manually anyway. Hooks are most interesting for the other pkg-infras, like autotools, cmake et al. since you do not have control of the build/install commands.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v2 1/2 i2c-tools: add hash file

In reply to Ryan Barnett

Ryan, All,

On 2015-04-05 14:48 -0500, Ryan Barnett spake thusly:

Quoted 12 lines
---
 package/i2c-tools/i2c-tools.hash | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 package/i2c-tools/i2c-tools.hash
package/i2c-tools/i2c-tools.hash new file +0 -0
new file mode 100644
index 0000000..a6c376f

package/i2c-tools/i2c-tools.hash line 2

Quoted 2 lines
package/i2c-tools/i2c-tools.hash new file +2 -0
@@ -0,0 +1,2 @@
+# locally computed hash
+sha256	14d4d7d60d1c12e43f2befe239c682a5c44c27682f153d4b58c1e392d2db1700  i2c-tools-3.1.1.tar.bz2

Manually verified the hash

Regards,
Yann E. MORIN.

Signature · 13 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150405/b0292970/attachment.asc>