diff --git a/cli/src/init.rs b/cli/src/init.rs index 018cfeb5..f2a8558b 100644 --- a/cli/src/init.rs +++ b/cli/src/init.rs @@ -515,14 +515,24 @@ pub fn generate_grammar_files( }, )?; - missing_path(repo_path.join("pyproject.toml"), |path| { + missing_path_else(repo_path.join("pyproject.toml"), allow_update, |path| { generate_file( path, PYPROJECT_TOML_TEMPLATE, dashed_language_name.as_str(), &generate_opts, ) - })?; + }, |path| { + let mut contents = fs::read_to_string(path)?; + if !contents.contains("cp310-*") { + contents = contents + .replace(r#"build = "cp39-*""#, r#"build = "cp310-*""#) + .replace(r#"python = ">=3.9""#, r#"python = ">=3.10""#) + .replace("tree-sitter~=0.22", "tree-sitter~=0.24"); + write_file(path, contents)?; + } + Ok(()) + })?; Ok(()) })?; @@ -705,11 +715,7 @@ fn generate_file( .map(|i| i + start_idx + 2) { replacement.replace_range(start_idx..end_idx, ""); - } else { - println!("none 2"); } - } else { - println!("none 1"); } } "grammar.js" => { @@ -719,11 +725,7 @@ fn generate_file( .map(|i| i + start_idx + 1) { replacement.replace_range(start_idx..end_idx, ""); - } else { - println!("none 2"); } - } else { - println!("none 1"); } } "Cargo.toml" => { diff --git a/cli/src/templates/pyproject.toml b/cli/src/templates/pyproject.toml index e0db4e21..e4cca2d4 100644 --- a/cli/src/templates/pyproject.toml +++ b/cli/src/templates/pyproject.toml @@ -14,7 +14,7 @@ classifiers = [ "Typing :: Typed", ] authors = [{ name = "PARSER_AUTHOR_NAME", email = "PARSER_AUTHOR_EMAIL" }] -requires-python = ">=3.9" +requires-python = ">=3.10" license.text = "PARSER_LICENSE" readme = "README.md" @@ -22,8 +22,8 @@ readme = "README.md" Homepage = "PARSER_URL" [project.optional-dependencies] -core = ["tree-sitter~=0.22"] +core = ["tree-sitter~=0.24"] [tool.cibuildwheel] -build = "cp39-*" +build = "cp310-*" build-frontend = "build" diff --git a/cli/src/templates/setup.py b/cli/src/templates/setup.py index 7dd0d8a4..0daba087 100644 --- a/cli/src/templates/setup.py +++ b/cli/src/templates/setup.py @@ -31,7 +31,7 @@ class BdistWheel(bdist_wheel): def get_tag(self): python, abi, platform = super().get_tag() if python.startswith("cp"): - python, abi = "cp39", "abi3" + python, abi = "cp310", "abi3" return python, abi, platform