使用Poetry结合Briefcase跨平台分发Python包时setup.py options参数解析及'linux'命令报错解决问询
I'm trying to distribute my Python package across operating systems using Briefcase (following the official BeeWare tutorial), but I'm more familiar with using Poetry for package management. I found a tutorial that combines the two tools, but when executing the final command poetry run python setup.py linux -s, I get the error: error: invalid command 'linux'.
Here's the code for the setup() function in my setup.py:
setup( name=<my-details>, # Personal details omitted here version=version, description=<my-details>, long_description=long_description, author=<my-details>, author_email=<my-details>, license='BSD license', packages=find_packages( exclude=[ 'docs', 'tests', 'windows', 'macOS', 'linux', 'iOS', 'android', 'django' ] ), classifiers=[ 'Development Status :: 1 - Planning', 'License :: OSI Approved :: BSD license', ], install_requires=[ ], options={ 'app': { 'formal_name': <my-details>, 'bundle': 'com.example' }, # Desktop/laptop deployments 'macos': { 'app_requires': [ 'toga-cocoa==0.3.0.dev15', ] }, 'linux': { 'app_requires': [ 'toga-gtk==0.3.0.dev15', ] }, 'windows': { 'app_requires': [ 'toga-winforms==0.3.0.dev15', ] }, # Mobile deployments 'ios': { 'app_requires': [ 'toga-ios==0.3.0.dev15', ] }, 'android': { 'app_requires': [ 'toga-android==0.3.0.dev15', ] }, # Web deployments 'django': { 'app_requires': [ 'toga-django==0.3.0.dev15', ] }, } )
I've looked up the purpose of the options parameter, but only found this brief description: "A dictionary providing the default options for the setup script." According to the tutorial, running that command should open a blank window (which works when I use Briefcase directly following the BeeWare tutorial). Since I prefer using Poetry as my primary package manager, I want to understand:
- The working mechanism and specific role of the
optionsparameter - How to properly configure this parameter to fix the current error, make the command work as expected, and open the blank window
内容的提问来源于stack exchange,提问作者Ren




