�
�f� � �@ � d Z ddlZddlZddlmZ ddlmZmZ ddlm Z m
Z
mZ ej e
� ZdZdedefd �Zdefd
�Zdee fd�Zdedefd�Zdefd
�Zdefd�Zdee fd�ZdZdededefd�Z G d� de j6 � Zee j: ffgZd� Zy)zA Datasource to support the Windows Subsystem for Linux platform. � N)�PurePath)�List�cast)�sources�subp�utilz/usr/bin/wslpath�path�returnc �r � t j t d| g� \ }}t |j � � S )a@
Translates a path inside the current WSL instance's filesystem to a
Windows accessible path.
Example:
# Running under an instance named "CoolInstance"
root = wslpath2win("/") # root == "//wsl.localhost/CoolInstance/"
:param path: string representing a Linux path, whether existing or not.
z-am�r �WSLPATH_CMDr �rstrip�r �out�_s �A/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceWSL.py�wsl_path_2_winr s. � � �Y�Y��U�D�1�
2�F�C���C�J�J�L�!�!� c �0 � t d� } | j S )zL
Returns the name of the current WSL instance as seen from outside.
�/)r �name)�
root_net_paths r �
instance_namer # s � � #�3�'�M����r c � � d} d}g }t j � j � D ]' |