Skip to content

Commit 37678e3

Browse files
committed
Fix build errors
1 parent eed4a0b commit 37678e3

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

src/fastapi/docker_files.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ RUN sh /uv-installer.sh && rm /uv-installer.sh
423423
424424
ENV PATH="/root/.local/bin:$PATH"
425425
426-
COPY pyproject.toml uv.lock ./
426+
COPY . ./
427427
428428
RUN --mount=type=cache,target=/root/.cache/uv \
429429
uv venv -p {python_version} \

src/python_files.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use anyhow::{bail, Result};
55
use crate::{
66
file_manager::save_file_with_content,
77
project_info::{ProjectInfo, ProjectManager},
8-
utils::is_python_312_or_greater,
8+
utils::is_python_311_or_greater,
99
};
1010

1111
fn create_dunder_main_file(module: &str, is_async_project: bool) -> String {
@@ -235,7 +235,7 @@ fn create_version_test_file(
235235
};
236236

237237
if let Some(v) = version_test {
238-
if is_python_312_or_greater(min_python_version)? {
238+
if is_python_311_or_greater(min_python_version)? {
239239
Ok(Some(format!(
240240
r#"import tomllib
241241
from pathlib import Path

src/utils.rs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
use anyhow::{bail, Result};
22

3+
pub fn is_python_311_or_greater(version: &str) -> Result<bool> {
4+
let version_parts = split_version(version)?;
5+
6+
if version_parts.1 >= 11 {
7+
Ok(true)
8+
} else {
9+
Ok(false)
10+
}
11+
}
12+
313
pub fn is_python_312_or_greater(version: &str) -> Result<bool> {
414
let version_parts = split_version(version)?;
515

@@ -38,23 +48,35 @@ mod tests {
3848
use super::*;
3949

4050
#[test]
41-
fn test_python_312() {
51+
fn test_python_312_312() {
4252
let result = is_python_312_or_greater("3.12").unwrap();
4353
assert!(result);
4454
}
4555

4656
#[test]
47-
fn test_python_313() {
57+
fn test_python_312_313() {
4858
let result = is_python_312_or_greater("3.13").unwrap();
4959
assert!(result);
5060
}
5161

5262
#[test]
53-
fn test_python_311() {
63+
fn test_python_312_311() {
5464
let result = is_python_312_or_greater("3.11").unwrap();
5565
assert!(!result);
5666
}
5767

68+
#[test]
69+
fn test_python_311_311() {
70+
let result = is_python_311_or_greater("3.11").unwrap();
71+
assert!(result);
72+
}
73+
74+
#[test]
75+
fn test_python_311_310() {
76+
let result = is_python_311_or_greater("3.10").unwrap();
77+
assert!(result);
78+
}
79+
5880
#[cfg(feature = "fastapi")]
5981
#[test]
6082
fn test_is_allowed_fastapi_python_version() {

0 commit comments

Comments
 (0)