PyBluezがMacOSにインストールされる方法を改善しようとしています。 Hereは、私の変更前の今日のsetup.pyコードです。ビルドされたフレームワークをpackage_dataでPythonパッケージにコピーする
つまり、macOSでは、lightblue
という追加のパッケージがインストールされており、これはLightAquaBlue.frameworkというフレームワークに依存しています。今日、xcodebuildを呼び出してフレームワークを構築し、/Library/Frameworks
にインストールしましたが、フレームワークをPythonパッケージに埋め込むように変更したいと思います。
は、ここで私がやったものだ:
packages.append('lightblue')
package_dir['lightblue'] = 'osx'
install_requires += ['pyobjc-core>=3.1', 'pyobjc-framework-Cocoa>=3.1']
# Add the LightAquaBlue framework to the package data as an 'eager resource'
# so that we can extract the whole framework at runtime
package_data['lightblue'] = [ 'LightAquaBlue.framework' ]
eager_resources.append('LightAquaBlue.framework')
# FIXME: This is inelegant, how can we cover the cases?
if 'install' in sys.argv or 'bdist' in sys.argv or 'bdist_egg' in sys.argv:
# Build the framework into osx/
import subprocess
subprocess.check_call([
'xcodebuild', 'install',
'-project', 'osx/LightAquaBlue/LightAquaBlue.xcodeproj',
'-scheme', 'LightAquaBlue',
'DSTROOT=' + os.path.join(os.getcwd(), 'osx'),
'INSTALL_PATH=/',
'DEPLOYMENT_LOCATION=YES',
])
は、これは(lightblue
パッケージのディレクトリです)osx/
内部LightAquaBlue.frameworkを構築し、その後package_data
としてsetuptoolsのに渡します。私はpip install --upgrade -v ./pybluez/
を実行すると、LightAquaBlue.frameworkがコピーされないあるしかし、:
creating build/lib/lightblue
copying osx/_bluetoothsockets.py -> build/lib/lightblue
copying osx/_LightAquaBlue.py -> build/lib/lightblue
copying osx/_obexcommon.py -> build/lib/lightblue
copying osx/_IOBluetoothUI.py -> build/lib/lightblue
copying osx/__init__.py -> build/lib/lightblue
copying osx/_IOBluetooth.py -> build/lib/lightblue
copying osx/_obex.py -> build/lib/lightblue
copying osx/_lightblue.py -> build/lib/lightblue
copying osx/obex.py -> build/lib/lightblue
copying osx/_macutil.py -> build/lib/lightblue
copying osx/_lightbluecommon.py -> build/lib/lightblue
私はsetup.py osx/
内部のダミーファイルを作成し、package_data
に追加している場合は、それはがコピーされますし。これは私にはパス上の混乱がないことを示唆しています。
os.system('ls osx/')
を追加すると、LightAquaBlue.frameworkが私のダミーファイルと同じ場所に存在することもわかります。
LightAquaBlue
--> LightAquaBlue.framework
DUMMY_FILE_THAT_WORKS
_IOBluetooth.py
_IOBluetoothUI.py
_LightAquaBlue.py
__init__.py
_bluetoothsockets.py
_lightblue.py
_lightbluecommon.py
_macutil.py
_obex.py
_obexcommon.py
obex.py
フレームワークが正しくコピーされないのはなぜですか?