diff --git a/rnodeconf/__init__.py b/rnodeconf/__init__.py new file mode 100644 index 0000000..c12f820 --- /dev/null +++ b/rnodeconf/__init__.py @@ -0,0 +1,7 @@ +import os +import glob + +from .rnodeconf import * + +modules = glob.glob(os.path.dirname(__file__)+"/*.py") +__all__ = [ os.path.basename(f)[:-3] for f in modules if not f.endswith('__init__.py')] \ No newline at end of file diff --git a/rnodeconf.py b/rnodeconf/rnodeconf.py similarity index 97% rename from rnodeconf.py rename to rnodeconf/rnodeconf.py index cd80884..f9688e2 100755 --- a/rnodeconf.py +++ b/rnodeconf/rnodeconf.py @@ -1,4 +1,27 @@ #!python3 + +# MIT License +# +# Copyright (c) 2018 Mark Qvist - unsigned.io +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from time import sleep import argparse import threading @@ -450,8 +473,6 @@ class RNode(): def parse_eeprom(self): if self.eeprom[ROM.ADDR_INFO_LOCK] == ROM.INFO_LOCK_BYTE: - # TODO: Remove - RNS.log("Provisioned device") from cryptography.hazmat.primitives import hashes from cryptography.hazmat.backends import default_backend @@ -548,7 +569,7 @@ def device_probe(): def config_interface(): pass -if __name__ == "__main__": +def main(): try: if not util.find_spec("serial"): raise ImportError("Serial module could not be found") @@ -1029,4 +1050,7 @@ if __name__ == "__main__": except KeyboardInterrupt: print("") - exit() \ No newline at end of file + exit() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..93d5fa0 --- /dev/null +++ b/setup.py @@ -0,0 +1,26 @@ +import setuptools + +with open("README.md", "r") as fh: + long_description = fh.read() + +setuptools.setup( + name="rnodeconf", + version="0.9.5", + author="Mark Qvist", + author_email="mark@unsigned.io", + description="Configuration Utility for RNode hardware", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/markqvist/rnodeconfigutil", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + entry_points= { + 'console_scripts': ['rnodeconf=rnodeconf:main'] + }, + install_requires=['pyserial', 'cryptography'], + python_requires='>=3.6', +) \ No newline at end of file