Skip to content

Commit

Permalink
Prepare for packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasminocha committed Feb 17, 2021
1 parent ba5113a commit e313631
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
venv
__pycache__
*.egg-info
.env
1 change: 1 addition & 0 deletions canvasfs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .__main__ import main
38 changes: 21 additions & 17 deletions canvasfs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,29 @@ def parse_args():

return parser.parse_args()

options = parse_args()
init_logging(options.debug)
def main():
options = parse_args()
init_logging(options.debug)

context = Context(options.context + 's')
context = Context(options.context + 's')

canvas_fs = CanvasFs(options.context_id, context)
fuse_options = set(pyfuse3.default_options)
fuse_options.add('fsname=canvasfs')
canvas_fs = CanvasFs(options.context_id, context)
fuse_options = set(pyfuse3.default_options)
fuse_options.add('fsname=canvasfs')

if options.debug_fuse:
fuse_options.add('debug')
if options.debug_fuse:
fuse_options.add('debug')

pyfuse3.init(canvas_fs, options.mountpoint, fuse_options)
pyfuse3.init(canvas_fs, options.mountpoint, fuse_options)

try:
trio.run(pyfuse3.main)
except KeyboardInterrupt:
pyfuse3.close()
except:
traceback.print_exc()
pyfuse3.close()
exit(1)
try:
trio.run(pyfuse3.main)
except KeyboardInterrupt:
pyfuse3.close()
except:
traceback.print_exc()
pyfuse3.close()
exit(1)

if __name__ == '__main__':
main()
27 changes: 27 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[metadata]
name = canvasfs
version = 0.0.0
url = https://github.com/shreyasminocha/canvas-fs
author = Shreyas Minocha
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: MIT License
description = Canvas LMS FUSE Filesystem
long_description = file: readme.md
long_description_content_type = text/markdown

[options]
python_requires = >=3.6
install_requires =
pyfuse3
requests
CacheControl
python-dotenv
trio

[options.entry_points]
console_scripts =
canvasfs = canvasfs:main

[build-system]
requires = ['setuptools', 'wheel']
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from setuptools import setup

if __name__ == '__main__':
setup()

0 comments on commit e313631

Please sign in to comment.