我正在努力改进PyBluez在macOS上的安装方式。Here是设置.py代码看起来像今天,在我改变之前。你知道吗
简而言之,在macOS上安装了一个名为lightblue
的额外包,这取决于一个名为浅蓝.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',
])
这建立了浅蓝.framework在osx/
(即lightblue
包的目录)中,然后将其作为package_data
传递给setuptools。但是,当我运行pip install --upgrade -v ./pybluez/
时浅蓝.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
如果我有设置.py在osx/
内创建一个虚拟文件,并将其添加到package_data
,它不会被复制。这对我来说意味着没有路径上的混乱。你知道吗
如果我加上os.system('ls osx/')
,它也会显示浅蓝.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
为什么没有正确地复制框架?你知道吗
它看起来像setuptools的文档contradicts the implementation,实际上您不能指定要包含在
package_data
中的目录。你知道吗不是很优雅,但我用了:
相关问题 更多 >
编程相关推荐