From d22ada23c2828cc111ce58370ddf802e988f83a3 Mon Sep 17 00:00:00 2001 From: Noah <33094578+coolreader18@users.noreply.github.com> Date: Mon, 10 May 2021 11:21:39 -0500 Subject: [PATCH 1/2] Improve the openssl vendoring situation --- .github/workflows/ci.yaml | 10 ++++++++-- Cargo.toml | 1 + vm/Cargo.toml | 5 +++-- vm/src/stdlib/ssl.rs | 6 +++--- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7fb327774..46adfc218 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,7 +29,10 @@ jobs: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 - name: Set up the Windows environment - run: choco install llvm + shell: bash + run: | + choco install llvm openssl + echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV if: runner.os == 'Windows' - name: Set up the Mac environment run: brew install autoconf automake libtool @@ -60,7 +63,10 @@ jobs: with: python-version: 3.8 - name: Set up the Windows environment - run: choco install llvm + shell: bash + run: | + choco install llvm openssl + echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV if: runner.os == 'Windows' - name: Set up the Mac environment run: brew install autoconf automake libtool diff --git a/Cargo.toml b/Cargo.toml index a6ca39e48..86ba88a9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ threading = ["rustpython-vm/threading"] zlib = ["rustpython-vm/zlib"] ssl = ["rustpython-vm/ssl"] +ssl-vendor = ["rustpython-vm/ssl-vendor"] [dependencies] log = "0.4" diff --git a/vm/Cargo.toml b/vm/Cargo.toml index d64344248..c44a45cde 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -22,7 +22,8 @@ ast = ["rustpython-ast"] compiler = ["rustpython-compiler", "rustpython-compiler-core", "ast"] parser = ["rustpython-parser", "ast"] -ssl = ["openssl", "openssl-sys", "openssl-probe", "foreign-types-shared"] +ssl = ["openssl", "openssl-sys", "foreign-types-shared"] +ssl-vendor = ["ssl", "openssl/vendored", "openssl-probe"] [dependencies] # Crypto: @@ -119,7 +120,7 @@ uname = "0.1.1" gethostname = "0.2.0" socket2 = "0.4.0" rustyline = "8.0" -openssl = { version = "0.10.32", features = ["vendored"], optional = true } +openssl = { version = "0.10.32", optional = true } openssl-sys = { version = "0.9", optional = true } openssl-probe = { version = "0.1", optional = true } which = "4.0" diff --git a/vm/src/stdlib/ssl.rs b/vm/src/stdlib/ssl.rs index cd1c0d486..6d54fefa2 100644 --- a/vm/src/stdlib/ssl.rs +++ b/vm/src/stdlib/ssl.rs @@ -967,9 +967,9 @@ fn parse_version_info(mut n: i64) -> (u8, u8, u8, u8, u8) { pub fn make_module(vm: &VirtualMachine) -> PyObjectRef { // if openssl is vendored, it doesn't know the locations of system certificates - match option_env!("OPENSSL_NO_VENDOR") { - None | Some("0") => {} - _ => openssl_probe::init_ssl_cert_env_vars(), + #[cfg(feature = "ssl-vendor")] + if let None | Some("0") = option_env!("OPENSSL_NO_VENDOR") { + openssl_probe::init_ssl_cert_env_vars(); } openssl::init(); From a45deaf7aca83e87a2141eaff8bc63dff08737c7 Mon Sep 17 00:00:00 2001 From: Noah <33094578+coolreader18@users.noreply.github.com> Date: Mon, 10 May 2021 11:26:18 -0500 Subject: [PATCH 2/2] Upgrade README --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 490334fd3..1724f1f23 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,27 @@ Or use the interactive shell: You can also install and run RustPython with the following: - $ cargo install rustpython + $ cargo install --git https://github.com/RustPython/RustPython $ rustpython Welcome to the magnificent Rust Python interpreter >>>>> -Or through the `conda` package manager: +(The `rustpython-*` crates are currently yanked from crates.io due to being out +of date and not building on newer rust versions; we hope to release a new +version Soon™) + +If you'd like to make https requests, you can enable the `ssl` feature, which +also lets you install the `pip` package manager. Note that on Windows, you may +need to install OpenSSL, or you can enable the `ssl-vendor` feature instead, +which compiles OpenSSL for you but requires a C compiler, perl, and `make`. + +Once you've installed rustpython with SSL support, you can install pip by +running: + + $ rustpython --install-pip + +You can also install RustPython through the `conda` package manager, though +this isn't officially supported and may be out of date: $ conda install rustpython -c conda-forge $ rustpython