Comments (7)
Hi,
It seems I forgot that Python under Cygwin uses /cygdrive/ for paths, not the Windows version.
I will need to check for this and handle the paths accordingly.
In the meantime, you won't be able to do anything with the scripts under Cygwin. If you're eager, you could try the official Windows version of Python 3.
from wsl-distribution-switcher.
Seems like this has more challenges than just the correct path handling. A few crucial Windows-specific calls are missing from Cygwin's Python that are otherwise present in the Windows distribution. For example, ctypes.windll
for __stdcall
-ing the ntfsea library functions is missing, only ctypes.cdll
is present with the __cdecl
calling convention. Other than that, simple things such as sys.getwindowsversion()
or os.getenv('LocalAppData')
are missing, or don't return the expected value.
from wsl-distribution-switcher.
There is no winreg
package in cygwin's* python. There is a cygwinreg available for installing via pip, however installing it doesn't help, even if I swap utils.py:8 to import cygwinreg
.
It should be fairly simple to get around some of the mentioned issues;
sys.getwindowsversion()cmd.exe /c ver
systeminfo.exe | grep OS
- python:
platform.system()
os.getenv('LocalAppData')
cmd.exe /c echo %LocalAppData%
- python:
os.getenv('LOCALAPPDATA')
import winreg
- /proc/registry (read-only)
regedit.exe file.reg
(requires a .reg file)reg.exe query /?
,reg.exe add /?
,reg flags /?
* I'm actually using babun, but it uses uses the same setup.ini to download the same binaries as setup.exe.
from wsl-distribution-switcher.
Thank you for taking the time and contributing solutions. I've made some progress over the weekend, but didn't have time to finish it yet.
For future reference, there are a few better solutions, such as fallback to cygwinreg
:
try:
import _winreg
except:
import cygwinreg
And as for handling paths and expanding such variables, cygpath
is a really useful command that comes preinstalled with Cygwin.
I'm not using babun, however, as far as I know it is based on Cygwin and should not deviate so hard that the script would not. Should babun not work when the Cygwin support comes out, please open a separate ticket, so I can take a look at it.
I'm trying to support most scenarios Windows users could be running a Python script under.
from wsl-distribution-switcher.
Well, cygwinreg does not support Python 3, so that solution is completely out.
Otherwise all other issues are fixed, and the script would be ready to go.
from wsl-distribution-switcher.
1036f15 adds support for Cygwin, however, it does not work yet.
Cygwin has a weird permission mapping scheme[1][2], which requires permissions to be completely reset before Windows can access any files or directories created.
Although running icacls rootfs-temp /t /reset
fixes this after the fact, while the extraction is happening, the NTFS Extended Attributes writer library has no access to the files, and as such the extracted files have no extended attributes.
This is a pretty annoying issue, it would be really nice if I could temporarily turn off this Windows-breaking permission mapping scheme. Alternatively, I'll most likely delay the attribute restoration part, however, this requires significant design changes on my part.
from wsl-distribution-switcher.
1036f15 fixes the permission issue.
One more issue left: on WSL versions before Windows interoperability, the hook scripts won't run as the output cannot be piped into Mintty. The user will just get " r r o r : 0 x 8 0 0 7 0 0 5 7".
Otherwise, the WSL installation is working. On Insider previews, the hook scripts will work as well.
from wsl-distribution-switcher.
Related Issues (20)
- [!] Failed to fetch manifest info for cetos: HTTP Error 401: Unauthorized HOT 1
- "[!] The Linux subsystem is not installed. Please go through the standard installation procedure first." HOT 3
- Unable to find lxrun.exe in the expected locations. HOT 4
- [!] Failed to find tag 12.04 for image ubuntu.
- my_lookupdev: socket: Socket type not supported HOT 2
- WSL2 docker on centos7.6 not good
- gentoo install failed
- no such file or directory HOT 1
- `python install.py rootfs_kalilinux_kali-linux-docker_latest.tar.gz` with python 3.7 HOT 3
- bash - command not found HOT 1
- APT Key Expired and Unable to Update / Install HOT 4
- How can i install 3 different distros ?
- Instead of Centos 6 dowloading Centos 7 HOT 1
- Set default os in WSL
- With the Fall Creators update, is this dead? HOT 1
- Persistent "You do not seem to have the default distribution installed anymore."
- no lxss HOT 3
- python3 install.py rootfs_kalilinux_kali-linux-docker_ latest.tar.gz errors in files:
- get.prebuild.py fails on SSLError error [SSL: CERTIFICATE_VERIFY_FAILED]
- Unable to find lxrun.exe in the expected locations. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wsl-distribution-switcher.