diff --git a/recipe/bld.bat b/recipe/bld.bat new file mode 100644 index 0000000..0c4c9a1 --- /dev/null +++ b/recipe/bld.bat @@ -0,0 +1,12 @@ +@echo on + +REM Build +cd pywinpty-src +%PYTHON% -m pip install . -vv --no-deps --no-build-isolation +if errorlevel 1 exit 1 + +REM Generate license +cargo-bundle-licenses --format yaml --output "%SRC_DIR%\THIRDPARTY.yml" +if errorlevel 1 exit 1 + +echo Build completed successfully \ No newline at end of file diff --git a/recipe/disable_conpty_backend.patch b/recipe/disable_conpty_backend.patch new file mode 100644 index 0000000..bbaccbf --- /dev/null +++ b/recipe/disable_conpty_backend.patch @@ -0,0 +1,23 @@ +diff --git a/build.rs b/build.rs +index 41105ea..ef43987 100644 +--- a/build.rs ++++ b/build.rs +@@ -177,15 +177,9 @@ fn main() { + // let kernel32 = kernel32_res.unwrap(); + + // let conpty = unsafe { GetProcAddress(kernel32, "CreatePseudoConsole".into_pcstr()) }; +- match major_version >= 10 && build_version >= 2004 { +- true => { +- conpty_enabled = "1"; +- println!("cargo:rustc-cfg=feature=\"conpty\"") +- } +- false => { +- conpty_enabled = "0"; +- } +- } ++ ++ // Skip ConPTY - use WinPTY backend only ++ conpty_enabled = "0"; + + println!("ConPTY enabled: {}", conpty_enabled); + println!("Output path: {}", get_output_path().to_str().unwrap()); diff --git a/recipe/disable_conpty_tests.patch b/recipe/disable_conpty_tests.patch new file mode 100644 index 0000000..ffc131a --- /dev/null +++ b/recipe/disable_conpty_tests.patch @@ -0,0 +1,26 @@ +diff --git a/winpty/tests/test_pty.py b/winpty/tests/test_pty.py +index 52fb4c1..25ca478 100644 +--- a/winpty/tests/test_pty.py ++++ b/winpty/tests/test_pty.py +@@ -38,7 +38,7 @@ conpty_provider = pty_factory(Backend.ConPTY) + winpty_provider = pty_factory(Backend.WinPTY) + + +-@pytest.fixture(scope='module', params=['WinPTY', 'ConPTY']) ++@pytest.fixture(scope='module', params=['WinPTY']) + def pty_fixture(request): + backend = request.param + if os.environ.get('CI_RUNNING', None) == '1': +diff --git a/winpty/tests/test_ptyprocess.py b/winpty/tests/test_ptyprocess.py +index 1d7662d..aad70ed 100644 +--- a/winpty/tests/test_ptyprocess.py ++++ b/winpty/tests/test_ptyprocess.py +@@ -19,7 +19,7 @@ from winpty.ptyprocess import PtyProcess, which + + + +-@pytest.fixture(scope='module', params=['WinPTY', 'ConPTY']) ++@pytest.fixture(scope='module', params=['WinPTY']) + def pty_fixture(request): + backend = request.param + if os.environ.get('CI_RUNNING', None) == '1': diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 9c63e86..4e9829a 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "2.0.15" %} +{% set version = "3.0.2" %} {% set name = "pywinpty" %} package: @@ -6,15 +6,23 @@ package: version: {{ version }} source: - url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz - sha256: 312cf39153a8736c617d45ce8b6ad6cd2107de121df91c455b10ce6bba7a39b2 + - url: https://pypi.org/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz + sha256: 1505cc4cb248af42cb6285a65c9c2086ee9e7e574078ee60933d5d7fa86fb004 + folder: pywinpty-src + patches: + - skip-pywinpty-nuget.patch + - use_local_winpty-rs.patch + + # winpty-rs: vendored in dependency + - url: https://github.com/andfoy/winpty-rs/archive/refs/tags/v1.0.4.tar.gz + sha256: d67f96abc22d4b13efb9a88969caf9929a2e8b1b928843b5ab122455e9640e7f + folder: winpty-rs-src + patches: + - disable_conpty_backend.patch build: number: 0 skip: true # [(not win) or py<39] - script: - - {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation - - cargo-bundle-licenses --format yaml --output "{{ SRC_DIR }}\THIRDPARTY.yml" requirements: build: @@ -37,23 +45,22 @@ test: - pip commands: - pip check - + - python -c "from importlib.metadata import version; assert(version('{{ name }}')=='{{ version }}')" about: - home: https://github.com/spyder-ide/pywinpty + home: https://github.com/andfoy/pywinpty license: MIT - license_file: - - LICENSE.txt + license_file: + - pywinpty-src/LICENSE.txt - THIRDPARTY.yml license_family: MIT summary: Pseudoterminals for Windows in Python description: | PyWinpty allows creating and communicating with Windows processes that receive input and print outputs via console input and output pipes. - PyWinpty supports both the native ConPTY interface and the previous, - fallback winpty library. - doc_url: https://github.com/spyder-ide/pywinpty - dev_url: https://github.com/spyder-ide/pywinpty + WinPTY backend is supported. + doc_url: https://github.com/andfoy/pywinpty + dev_url: https://github.com/andfoy/pywinpty extra: recipe-maintainers: diff --git a/recipe/skip-pywinpty-nuget.patch b/recipe/skip-pywinpty-nuget.patch new file mode 100644 index 0000000..510fad2 --- /dev/null +++ b/recipe/skip-pywinpty-nuget.patch @@ -0,0 +1,17 @@ +diff --git a/build.rs b/build.rs +index 0e509b5..daf1541 100644 +--- a/build.rs ++++ b/build.rs +@@ -27,7 +27,11 @@ fn main() { + let nuget_found = command_ok(nuget.arg("help")); + + if !nuget_found { +- panic!("NuGet is required to build pywinpty"); ++ // Skip NuGet - use conda-provided winpty ++ println!("cargo:warning=Skipping NuGet check, using system-provided winpty"); ++ println!("cargo:rustc-link-search=native={}", env::var("LIBRARY_LIB").unwrap_or_default()); ++ println!("cargo:rustc-link-lib=winpty"); ++ return; + } + + if command_ok( diff --git a/recipe/use_local_winpty-rs.patch b/recipe/use_local_winpty-rs.patch new file mode 100644 index 0000000..342475b --- /dev/null +++ b/recipe/use_local_winpty-rs.patch @@ -0,0 +1,14 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 53c075f..3022765 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -17,7 +17,8 @@ crate-type = ["cdylib"] + glob = "0.3.2" + + [dependencies] +-winpty-rs = "1.0.4" ++# We'll use a local version of winpty-rs (vendored) ++winpty-rs = { path = "../winpty-rs-src" } + + [dependencies.pyo3] + version = "0.26.0"