Skip to content

Commit

Permalink
add setup.py and upload to PyPI
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
mxmlnkn committed Nov 16, 2019
1 parent f2a3500 commit b776baf
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 20 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

Combines the random access indexing idea from [tarindexer](https://github.com/devsnd/tarindexer) and then mounts the tar using [fusepy](https://github.com/fusepy/fusepy) for easy read-only access just like [archivemount](https://github.com/cybernoid/archivemount/). It also will mount TARs inside TARs inside TARs, ... recursively into folders of the same name, which is useful for the ImageNet data set.

# Requirements
# Installation

- Python3
- fusepy
- msgpack (This is the default serialization for the cached file index. However, there also is a pickle backend which does not require an additional install but has more memory overhead)
- [optional] any of the other serialization backends. (Most of these are for benchmark purposes and can be ignored.)

E.g. on Debian-like systems these can be installed with:
You can simply install it from PyPI:
```
pip install ratarmount
```

Or, if you want to test the latest devlopment version on a Debian-like system:
```bash
sudo apt-get update
sudo apt-get install python3 python3-pip
pip3 install --user -r requirements.txt
sudo apt-get install python3 python3-pip git
git clone https://github.com/mxmlnkn/ratarmount.git
python3 -m pip install --user .
ratarmount --help
```

# Usage
Expand Down
11 changes: 8 additions & 3 deletions ratarmount.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import argparse
import itertools
import io
import itertools
import os
import re
import stat
Expand Down Expand Up @@ -271,7 +272,7 @@ def getFileInfo( self, path, listDir = False ):
for name in os.path.normpath( path ).split( os.sep ):
if not name:
continue
if not name in p:
if name not in p:
return None
p = p[name]

Expand Down Expand Up @@ -769,7 +770,7 @@ def read( self, path, length, offset, fh ):
return self.tarFile.read( length )


if __name__ == '__main__':
def cli():
parser = argparse.ArgumentParser(
formatter_class = argparse.ArgumentDefaultsHelpFormatter,
description = '''\
Expand Down Expand Up @@ -837,6 +838,7 @@ def read( self, path, length, offset, fh ):
if not os.path.exists( mountPath ):
os.mkdir( mountPath )

global printDebug
printDebug = args.debug

fuseOperationsObject = TarMount(
Expand All @@ -852,3 +854,6 @@ def read( self, path, length, offset, fh ):

if mountPathWasCreated and args.foreground:
os.rmdir( mountPath )

if __name__ == '__main__':
cli()
8 changes: 0 additions & 8 deletions requirements.txt

This file was deleted.

32 changes: 32 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from setuptools import setup

setup(
name = 'ratarmount',
version = '0.1.0',

description = 'Random Access Read-Only Tar Mount',
url = 'https://github.com/mxmlnkn',
author = 'Maximilian Knespel',
author_email = '[email protected]',
license = 'MIT',
classifiers = [ 'License :: OSI Approved :: MIT License',
'Development Status :: 3 - Alpha',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python :: 3',
'Topic :: System :: Archiving' ],

py_modules = [ 'ratarmount' ],
install_requires = [ 'fusepy',
'lz4',
'msgpack',
'simplejson',
'pyyaml',
'ujson',
'cbor',
'python-rapidjson' ],
entry_points = { 'console_scripts': [ 'ratarmount=ratarmount:cli' ] }
)

0 comments on commit b776baf

Please sign in to comment.