%global _empty_manifest_terminate_build 0
Name:		python-sshfs
Version:	2023.4.1
Release:	1
Summary:	SSH Filesystem -- Async SSH/SFTP backend for fsspec
License:	Apache License 2.0
URL:		https://pypi.org/project/sshfs/
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/01/a1/20f5ed702a87b3c2b501698613e8b4d8ce3fa61722c937937658dfd78249/sshfs-2023.4.1.tar.gz
BuildArch:	noarch

Requires:	python3-fsspec
Requires:	python3-asyncssh
Requires:	python3-asyncssh[bcrypt]
Requires:	python3-asyncssh[fido2]
Requires:	python3-asyncssh[gssapi]
Requires:	python3-asyncssh[libnacl]
Requires:	python3-asyncssh[python-pkcs11]
Requires:	python3-asyncssh[pyopenssl]
Requires:	python3-asyncssh[pywin32]

%description
# sshfs

sshfs is an implementation of [fsspec](https://github.com/intake/filesystem_spec/) for
the SFTP protocol using [asyncssh](https://github.com/ronf/asyncssh).

## Features

- A complete implementation of the fsspec protocol through SFTP
- Supports features outside of the SFTP (e.g server side copy through SSH command execution)
- Quite fast (compared to alternatives like paramiko)
- Builtin Channel Management
- Async! (thanks to `asyncssh`)

## Tutorial

Install the `sshfs` from PyPI or the conda-forge, and import it;

```py
from sshfs import SSHFileSystem
```

To connect with a password, you can simply specify `username`/`password`
as keyword arguments and connect to the host of your choosing;

```py
# Connect with a password
fs = SSHFileSystem(
    '127.0.0.1',
    username='sam',
    password='fishing'
)
```

If you want to use a private key to authenticate, you can either
pass a string pointing to the path of the key, or give a list of
them to be tried:

```py
# or with a private key
fs = SSHFileSystem(
    'ssh.example.com',
    client_keys=['/path/to/ssh/key']
)
```

All operations and their descriptions are specified [here](https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.spec.AbstractFileSystem).
Here are a few example calls you can make, starting with `info()` which allows you to retrieve the metadata about given path;

```py
>>> details = fs.info('/tmp')
>>> print(f'{details["name"]!r} is a {details["type"]}!')
'/tmp/' is a directory!
>>>
>>> crontab = fs.info('/etc/crontab')
>>> print(f'{crontab["name"]!r} is a {crontab["type"]}!')
'/etc/crontab' is a file!
```

You can also create new files through either putting a local file with `put_file` or opening a file in write mode;

```py
>>> with fs.open('/tmp/message.dat', 'wb') as stream:
...     stream.write(b'super secret messsage!')
... 
```

And either download it through `get_file` or simply read it on the fly with opening it;

```py
>>> with fs.open('/tmp/message.dat') as stream:
...     print(stream.read())
... 
b'super secret messsage!'
```

There are also a lot of other basic filesystem operations, such as `mkdir`, `touch` and `find`;

```py
>>> fs.mkdir('/tmp/dir')
>>> fs.mkdir('/tmp/dir/eggs')
>>> fs.touch('/tmp/dir/spam')
>>> fs.touch('/tmp/dir/eggs/quux')
>>> 
>>> for file in fs.find('/tmp/dir'):
...     print(file)
... 
/tmp/dir/eggs/quux
/tmp/dir/spam
```

If you want to list a directory but not it's children, you can use `ls()`;

```py
>>> [(detail['name'], detail['type']) for detail in fs.ls('/tmp/dir', detail=True)]
[('/tmp/dir/spam', 'file'), ('/tmp/dir/eggs', 'directory')]
```


%package -n python3-sshfs
Summary:	SSH Filesystem -- Async SSH/SFTP backend for fsspec
Provides:	python-sshfs
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-sshfs
# sshfs

sshfs is an implementation of [fsspec](https://github.com/intake/filesystem_spec/) for
the SFTP protocol using [asyncssh](https://github.com/ronf/asyncssh).

## Features

- A complete implementation of the fsspec protocol through SFTP
- Supports features outside of the SFTP (e.g server side copy through SSH command execution)
- Quite fast (compared to alternatives like paramiko)
- Builtin Channel Management
- Async! (thanks to `asyncssh`)

## Tutorial

Install the `sshfs` from PyPI or the conda-forge, and import it;

```py
from sshfs import SSHFileSystem
```

To connect with a password, you can simply specify `username`/`password`
as keyword arguments and connect to the host of your choosing;

```py
# Connect with a password
fs = SSHFileSystem(
    '127.0.0.1',
    username='sam',
    password='fishing'
)
```

If you want to use a private key to authenticate, you can either
pass a string pointing to the path of the key, or give a list of
them to be tried:

```py
# or with a private key
fs = SSHFileSystem(
    'ssh.example.com',
    client_keys=['/path/to/ssh/key']
)
```

All operations and their descriptions are specified [here](https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.spec.AbstractFileSystem).
Here are a few example calls you can make, starting with `info()` which allows you to retrieve the metadata about given path;

```py
>>> details = fs.info('/tmp')
>>> print(f'{details["name"]!r} is a {details["type"]}!')
'/tmp/' is a directory!
>>>
>>> crontab = fs.info('/etc/crontab')
>>> print(f'{crontab["name"]!r} is a {crontab["type"]}!')
'/etc/crontab' is a file!
```

You can also create new files through either putting a local file with `put_file` or opening a file in write mode;

```py
>>> with fs.open('/tmp/message.dat', 'wb') as stream:
...     stream.write(b'super secret messsage!')
... 
```

And either download it through `get_file` or simply read it on the fly with opening it;

```py
>>> with fs.open('/tmp/message.dat') as stream:
...     print(stream.read())
... 
b'super secret messsage!'
```

There are also a lot of other basic filesystem operations, such as `mkdir`, `touch` and `find`;

```py
>>> fs.mkdir('/tmp/dir')
>>> fs.mkdir('/tmp/dir/eggs')
>>> fs.touch('/tmp/dir/spam')
>>> fs.touch('/tmp/dir/eggs/quux')
>>> 
>>> for file in fs.find('/tmp/dir'):
...     print(file)
... 
/tmp/dir/eggs/quux
/tmp/dir/spam
```

If you want to list a directory but not it's children, you can use `ls()`;

```py
>>> [(detail['name'], detail['type']) for detail in fs.ls('/tmp/dir', detail=True)]
[('/tmp/dir/spam', 'file'), ('/tmp/dir/eggs', 'directory')]
```


%package help
Summary:	Development documents and examples for sshfs
Provides:	python3-sshfs-doc
%description help
# sshfs

sshfs is an implementation of [fsspec](https://github.com/intake/filesystem_spec/) for
the SFTP protocol using [asyncssh](https://github.com/ronf/asyncssh).

## Features

- A complete implementation of the fsspec protocol through SFTP
- Supports features outside of the SFTP (e.g server side copy through SSH command execution)
- Quite fast (compared to alternatives like paramiko)
- Builtin Channel Management
- Async! (thanks to `asyncssh`)

## Tutorial

Install the `sshfs` from PyPI or the conda-forge, and import it;

```py
from sshfs import SSHFileSystem
```

To connect with a password, you can simply specify `username`/`password`
as keyword arguments and connect to the host of your choosing;

```py
# Connect with a password
fs = SSHFileSystem(
    '127.0.0.1',
    username='sam',
    password='fishing'
)
```

If you want to use a private key to authenticate, you can either
pass a string pointing to the path of the key, or give a list of
them to be tried:

```py
# or with a private key
fs = SSHFileSystem(
    'ssh.example.com',
    client_keys=['/path/to/ssh/key']
)
```

All operations and their descriptions are specified [here](https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.spec.AbstractFileSystem).
Here are a few example calls you can make, starting with `info()` which allows you to retrieve the metadata about given path;

```py
>>> details = fs.info('/tmp')
>>> print(f'{details["name"]!r} is a {details["type"]}!')
'/tmp/' is a directory!
>>>
>>> crontab = fs.info('/etc/crontab')
>>> print(f'{crontab["name"]!r} is a {crontab["type"]}!')
'/etc/crontab' is a file!
```

You can also create new files through either putting a local file with `put_file` or opening a file in write mode;

```py
>>> with fs.open('/tmp/message.dat', 'wb') as stream:
...     stream.write(b'super secret messsage!')
... 
```

And either download it through `get_file` or simply read it on the fly with opening it;

```py
>>> with fs.open('/tmp/message.dat') as stream:
...     print(stream.read())
... 
b'super secret messsage!'
```

There are also a lot of other basic filesystem operations, such as `mkdir`, `touch` and `find`;

```py
>>> fs.mkdir('/tmp/dir')
>>> fs.mkdir('/tmp/dir/eggs')
>>> fs.touch('/tmp/dir/spam')
>>> fs.touch('/tmp/dir/eggs/quux')
>>> 
>>> for file in fs.find('/tmp/dir'):
...     print(file)
... 
/tmp/dir/eggs/quux
/tmp/dir/spam
```

If you want to list a directory but not it's children, you can use `ls()`;

```py
>>> [(detail['name'], detail['type']) for detail in fs.ls('/tmp/dir', detail=True)]
[('/tmp/dir/spam', 'file'), ('/tmp/dir/eggs', 'directory')]
```


%prep
%autosetup -n sshfs-2023.4.1

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-sshfs -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 2023.4.1-1
- Package Spec generated