rye icon indicating copy to clipboard operation
rye copied to clipboard

Windows Support

Open dvtkrlbs opened this issue 1 year ago • 5 comments

I am opening this issue to investigate Windows support. I will do a test tomorrow to see what is needed and what is missing ?

Thank you for this nice tool

dvtkrlbs avatar Apr 24 '23 00:04 dvtkrlbs

https://github.com/dvtkrlbs/rye created a fork fixing a few compilation errors. I put TODO comments on a few problems and a place where I did not understand what the code does.

Summary is there is no as_bytes on OsString extension on Window (Something something wtf8 implementation detail), I could not find a sane command spawning on windows that allows you to get the spawn prepare status. (There is CreateProcessW crate which wraps the windows function with a command like interface that returns early errors as well but the arg handling feels limited). There is two mode checks that does something I don't understand what it does and there is no mode flags on Windows.

dvtkrlbs avatar Apr 24 '23 01:04 dvtkrlbs

Hi! I tested on my machine and (as of today) gives me the following errors:

cargo install --git https://github.com/mitsuhiko/rye rye
   Compiling rye v0.1.0 (C:\Users\aucac\scoop\persist\rustup\.cargo\git\checkouts\rye-ab2f5dcb3700b165\bbebf34\rye)
error[E0433]: failed to resolve: could not find `unix` in `os`
   --> rye\src\bootstrap.rs:117:22
    |
117 |         use std::os::unix::fs::symlink;
    |                      ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\cli\run.rs:3:14
  |
3 | use std::os::unix::prelude::OsStrExt;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\cli\shim.rs:3:14
  |
3 | use std::os::unix::prelude::OsStrExt;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\cli\toolchain.rs:5:14
  |
5 | use std::os::unix::fs::symlink;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\installer.rs:2:14
  |
2 | use std::os::unix::fs::symlink;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\pyproject.rs:7:14
  |
7 | use std::os::unix::prelude::MetadataExt;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\sync.rs:1:14
  |
1 | use std::os::unix::fs::symlink;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unistd` in `nix`
  --> rye\src\cli\run.rs:90:28
   |
90 |     if let Err(err) = nix::unistd::execv(&path, &args) {
   |                            ^^^^^^ could not find `unistd` in `nix`

error[E0433]: failed to resolve: could not find `Error` in `nix`
  --> rye\src\cli\run.rs:91:24
   |
91 |         if err == nix::Error::ENOENT {
   |                        ^^^^^ could not find `Error` in `nix`

error[E0433]: failed to resolve: could not find `unistd` in `nix`
   --> rye\src\cli\shim.rs:113:18
    |
113 |             nix::unistd::execv(&path, &args)
    |                  ^^^^^^ could not find `unistd` in `nix`

error[E0599]: no method named `as_bytes` found for reference `&OsString` in the current scope
  --> rye\src\cli\run.rs:73:40
   |
73 |         .filter_map(|x| CString::new(x.as_bytes()).ok())
   |                                        ^^^^^^^^ method not found in `&OsString`

error[E0599]: no method named `as_bytes` found for reference `&OsString` in the current scope
   --> rye\src\cli\shim.rs:110:48
    |
110 |                 .filter_map(|x| CString::new(x.as_bytes()).ok())
    |                                                ^^^^^^^^ method not found in `&OsString`

error[E0599]: no method named `mode` found for struct `Metadata` in the current scope
   --> rye\src\pyproject.rs:308:52
    |
308 |         if external.metadata().map_or(false, |x| x.mode() & 0o001 != 0) {
    |                                                    ^^^^ help: there is a method with a similar name: `modified`

error[E0599]: no method named `mode` found for struct `Metadata` in the current scope
   --> rye\src\pyproject.rs:353:54
    |
353 |             if entry.metadata().map_or(false, |x| (x.mode() & 0o001) != 0) {
    |                                                      ^^^^ help: there is a method with a similar name: `modified`

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `rye` due to 14 previous errors
error: failed to compile `rye v0.1.0 (https://github.com/mitsuhiko/rye#bbebf34c)`, intermediate artifacts can be found at `C:\Users\aucac\AppData\Local\Temp\cargo-installbTwG2D`

AucaCoyan avatar Apr 25 '23 11:04 AucaCoyan

Windows support definitely requires a bit of work. It's not a lot of work, but it's about a week worth of it I would say. Even if it were to compile today it wouldn't work because it assumes a posix structure for the virtualenv today.

mitsuhiko avatar Apr 25 '23 13:04 mitsuhiko

Hi! I tested on my machine and (as of today) gives me the following errors:

cargo install --git https://github.com/mitsuhiko/rye rye

   Compiling rye v0.1.0 (C:\Users\aucac\scoop\persist\rustup\.cargo\git\checkouts\rye-ab2f5dcb3700b165\bbebf34\rye)
error[E0433]: failed to resolve: could not find `unix` in `os`
   --> rye\src\bootstrap.rs:117:22
    |
117 |         use std::os::unix::fs::symlink;
    |                      ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\cli\run.rs:3:14
  |
3 | use std::os::unix::prelude::OsStrExt;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\cli\shim.rs:3:14
  |
3 | use std::os::unix::prelude::OsStrExt;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\cli\toolchain.rs:5:14
  |
5 | use std::os::unix::fs::symlink;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\installer.rs:2:14
  |
2 | use std::os::unix::fs::symlink;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\pyproject.rs:7:14
  |
7 | use std::os::unix::prelude::MetadataExt;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> rye\src\sync.rs:1:14
  |
1 | use std::os::unix::fs::symlink;
  |              ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unistd` in `nix`
  --> rye\src\cli\run.rs:90:28
   |
90 |     if let Err(err) = nix::unistd::execv(&path, &args) {
   |                            ^^^^^^ could not find `unistd` in `nix`

error[E0433]: failed to resolve: could not find `Error` in `nix`
  --> rye\src\cli\run.rs:91:24
   |
91 |         if err == nix::Error::ENOENT {
   |                        ^^^^^ could not find `Error` in `nix`

error[E0433]: failed to resolve: could not find `unistd` in `nix`
   --> rye\src\cli\shim.rs:113:18
    |
113 |             nix::unistd::execv(&path, &args)
    |                  ^^^^^^ could not find `unistd` in `nix`

error[E0599]: no method named `as_bytes` found for reference `&OsString` in the current scope
  --> rye\src\cli\run.rs:73:40
   |
73 |         .filter_map(|x| CString::new(x.as_bytes()).ok())
   |                                        ^^^^^^^^ method not found in `&OsString`

error[E0599]: no method named `as_bytes` found for reference `&OsString` in the current scope
   --> rye\src\cli\shim.rs:110:48
    |
110 |                 .filter_map(|x| CString::new(x.as_bytes()).ok())
    |                                                ^^^^^^^^ method not found in `&OsString`

error[E0599]: no method named `mode` found for struct `Metadata` in the current scope
   --> rye\src\pyproject.rs:308:52
    |
308 |         if external.metadata().map_or(false, |x| x.mode() & 0o001 != 0) {
    |                                                    ^^^^ help: there is a method with a similar name: `modified`

error[E0599]: no method named `mode` found for struct `Metadata` in the current scope
   --> rye\src\pyproject.rs:353:54
    |
353 |             if entry.metadata().map_or(false, |x| (x.mode() & 0o001) != 0) {
    |                                                      ^^^^ help: there is a method with a similar name: `modified`

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `rye` due to 14 previous errors
error: failed to compile `rye v0.1.0 (https://github.com/mitsuhiko/rye#bbebf34c)`, intermediate artifacts can be found at `C:\Users\aucac\AppData\Local\Temp\cargo-installbTwG2D`

I have the same problem.

pengwon avatar Apr 29 '23 04:04 pengwon

I started a discussion about what some lower boundary Windows versions could be over here: https://github.com/mitsuhiko/rye/discussions/67

mitsuhiko avatar Apr 29 '23 09:04 mitsuhiko