Skip to content

Commit

Permalink
Adjusted project generator for python setting removal
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
  • Loading branch information
paulober committed Sep 23, 2024
1 parent 90548a9 commit efa952a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ This command installs all of the necessary tools, including but not limited to:
This extension provides the following settings:

* `raspberry-pi-pico.cmakePath`: Specify a custom path for CMake.
* `raspberry-pi-pico.python3Path`: Specify a custom path for Python 3.
* `raspberry-pi-pico.python3Path`: Specify a custom path for Python 3 _(machine scoped)_.
* `raspberry-pi-pico.ninjaPath`: Specify a custom path for Ninja.
* `raspberry-pi-pico.gitPath`: Specify a custom path for Git.
* `raspberry-pi-pico.cmakeAutoConfigure`: Provide a GitHub personal access token (classic) with the `public_repo` scope. This token is used to check for available versions of the Pico SDK and other tools. Without it, the extension uses the unauthenticated GitHub API, which has a lower rate limit and may lead to restricted functionality if the limit is exceeded. The unauthenticated rate limit is per public IP address, so a token is more necessary if your IP is shared with many users.
Expand Down
11 changes: 1 addition & 10 deletions scripts/pico_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ def ParseCommandLine():
parser.add_argument("-picotoolVersion", "--picotoolVersion", help="Picotool version to use (required)")
parser.add_argument("-np", "--ninjaPath", help="Ninja path")
parser.add_argument("-cmp", "--cmakePath", help="CMake path")
parser.add_argument("-cupy", "--customPython", action='store_true', help="Custom python path used to execute the script.")
parser.add_argument("-openOCDVersion", "--openOCDVersion", help="OpenOCD version to use - defaults to 0", default=0)
parser.add_argument("-examLibs", "--exampleLibs", action='append', help="Include an examples library in the folder")
parser.add_argument("-ucmt", "--useCmakeTools", action='store_true', help="Enable CMake Tools extension integration")
Expand Down Expand Up @@ -766,7 +765,7 @@ def GenerateCMake(folder, params):


# Generates the requested project files, if any
def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger, sdkVersion, toolchainVersion, picotoolVersion, ninjaPath, cmakePath, customPython, openOCDVersion, useCmakeTools):
def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger, sdkVersion, toolchainVersion, picotoolVersion, ninjaPath, cmakePath, openOCDVersion, useCmakeTools):

oldCWD = os.getcwd()

Expand Down Expand Up @@ -896,8 +895,6 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
}}
'''

pythonExe = sys.executable.replace("\\", "/").replace(user_home, "${HOME}") if use_home_var else sys.executable

# kits
kits = f'''[
{{
Expand Down Expand Up @@ -970,10 +967,6 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
"raspberry-pi-pico.useCmakeTools": {"true" if useCmakeTools else "false"},
"raspberry-pi-pico.cmakePath": "{cmakePath.replace(user_home, "${HOME}") if use_home_var else cmakePath}",
"raspberry-pi-pico.ninjaPath": "{ninjaPath.replace(user_home, "${HOME}") if use_home_var else ninjaPath}"'''

if customPython:
settings += f''',
"raspberry-pi-pico.python3Path": "{pythonExe}"'''

settings += '\n}\n'

Expand Down Expand Up @@ -1236,7 +1229,6 @@ def DoEverything(parent, params):
params["picotoolVersion"],
params["ninjaPath"],
params["cmakePath"],
params["customPython"],
params["openOCDVersion"],
params['useCmakeTools'])

Expand Down Expand Up @@ -1360,7 +1352,6 @@ def DoEverything(parent, params):
'picotoolVersion': args.picotoolVersion,
'ninjaPath' : args.ninjaPath,
'cmakePath' : args.cmakePath,
'customPython' : args.customPython,
'openOCDVersion': args.openOCDVersion,
'exampleLibs' : args.exampleLibs if args.exampleLibs is not None else [],
'useCmakeTools' : args.useCmakeTools
Expand Down
3 changes: 1 addition & 2 deletions src/webview/newProjectPanel.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,7 @@ export class NewProjectPanel {
);

const command: string = [
// TODO: maybe use includes powershell instead of .exe and ===
`${process.env.ComSpec === "powershell.exe" ? "&" : ""}"${pythonExe}"`,
`"${joinPosix(getScriptsRoot(), "pico_project.py")}"`,
...basicNewProjectOptions,
Expand Down Expand Up @@ -2311,8 +2312,6 @@ export class NewProjectPanel {
`"${options.cmakeExecutable}"`,
options.useCmakeTools ? "-ucmt" : "",

// set custom python executable path used flag if python executable is not in PATH
pythonExe.includes("/") ? "-cupy" : "",
`"${projectName}"`,
].join(" ");

Expand Down

0 comments on commit efa952a

Please sign in to comment.