From 9f9f2ea91475437716c871097d0b4a3b7aa57ad2 Mon Sep 17 00:00:00 2001 From: Samuel Sadok Date: Tue, 26 May 2020 20:53:14 +0200 Subject: [PATCH] Fix installation and dependencies of odrivetool Previously the install would fail if monotonic and appdirs were not already installed before installing odrivetool. --- tools/odrive/version.py | 6 +++--- tools/setup.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/odrive/version.py b/tools/odrive/version.py index a96e9b4e..3b88a255 100644 --- a/tools/odrive/version.py +++ b/tools/odrive/version.py @@ -82,12 +82,12 @@ if __name__ == '__main__': def setup_udev_rules(logger): if platform.system() != 'Linux': - logger.error("This command only makes sense on Linux") + if logger: logger.error("This command only makes sense on Linux") return if os.getuid() != 0: - logger.warn("you should run this as root, otherwise it will probably not work") + if logger: logger.warn("you should run this as root, otherwise it will probably not work") with open('/etc/udev/rules.d/91-odrive.rules', 'w') as file: file.write('SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0d3[0-9]", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"\n') subprocess.check_call(["udevadm", "control", "--reload-rules"]) subprocess.check_call(["udevadm", "trigger"]) - logger.info('udev rules configured successfully') + if logger: logger.info('udev rules configured successfully') diff --git a/tools/setup.py b/tools/setup.py index 118f0ae5..83d5c1ed 100644 --- a/tools/setup.py +++ b/tools/setup.py @@ -91,9 +91,8 @@ if creating_package: if not creating_package: import platform if platform.system() == 'Linux': - from fibre.utils import Logger try: - odrive.version.setup_udev_rules(Logger()) + odrive.version.setup_udev_rules(None) except Exception: print("Warning: could not set up udev rules. Run `sudo odrivetool udev-setup` to try again.") @@ -117,6 +116,7 @@ try: 'IntelHex', # Used to by DFU to download firmware from github 'matplotlib', # Required to run the liveplotter 'monotonic', # For compatibility with older python versions + 'appdirs', # Used to find caching directory 'pywin32 >= 222; platform_system == "Windows"' # Required for fancy terminal features on Windows ], package_data={'': ['version.txt']},