Fix installation and dependencies of odrivetool

Previously the install would fail if monotonic and appdirs were not
already installed before installing odrivetool.
This commit is contained in:
Samuel Sadok
2020-05-26 20:53:14 +02:00
parent 2b38ce7513
commit 9f9f2ea914
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -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')
+2 -2
View File
@@ -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']},