1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

エッジで使う端末用にwheelを作ったときのメモ

Last updated at Posted at 2019-12-25

背景

  • エッジ端末でPython3を使って色々する
  • armv7とかaarch64向けのwheelがPyPIにない(事が多い

とりあえずスクリプトにしてみる

make_wheel_from_tarball.sh
#!/bin/bash
# coding: utf-8

for pathfile in ./*.tar.gz ; do
	tar zxvf $pathfile

	# python3 ${pathfile%.*}/setup.py bdist_wheel

	dir=${pathfile%.*.*}/
	cd $dir
	python3 setup.py bdist_wheel

	whl=`find ./ -iname *.whl`
	mv $whl ../

	cd ../
	rm $pathfile
	rm -r $dir
done

実行してtarballからwheelができることを確認。
なぜかエラーになったやつの対処をググる。

invalid command 'bdist_wheel'のエラーが出る時

解凍したtarballのsetup.pyを1行変更すればOK

setup.py
#from distutils.core import setup
from setuptools import setup

あとがき

  • エッジ端末で使う場合は複数端末に同じライブラリを入れるので、多少面倒でもwheelを作っておいたほうが展開が楽
    • pipで毎回ビルド走るより、wheel作って/tmpとかに展開してpip3 -r requirements.txtするほうが早い
  • 基本tarballだから決め打ちにしたけど、zipも判定に入れたほうがいいかも
  • どうせならsetup.pyのパッチもスクリプト化したほうg(ry
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?