README.md 3.46 KB
Newer Older
Hamish McIntyre-Bhatty's avatar
Hamish McIntyre-Bhatty committed
1
# getdevinfo
Hamish McIntyre-Bhatty's avatar
Hamish McIntyre-Bhatty committed
2

3
This repository holds my new getdevinfo module. This module was originally integreted directly into the source code of Wine Autostart, DDRescue-GUI, and WxFixBoot, but has now been separated for ease of maintenance. Because it's on GitLab (https://gitlab.com/hamishmb/getdevinfo) and on PyPI (the Python Package Index) (https://pypi.org/project/getdevinfo/), and released under the GPLv3+, this means other people can use it too.
4

5
6
7
[![pipeline status](https://gitlab.com/hamishmb/getdevinfo/badges/master/pipeline.svg)](https://gitlab.com/hamishmb/getdevinfo/-/commits/master)


8
9
Description of Package
======================
Hamish McIntyre-Bhatty's avatar
Hamish McIntyre-Bhatty committed
10
A device information gatherer for Linux, macOS and Cygwin/Windows.
11

Hamish McIntyre-Bhatty's avatar
Hamish McIntyre-Bhatty committed
12
13
14
Working on both Linux, macOS and Cygwin, this script makes use of lshw, lvdisplay, and blkid (Linux), as well as diskutil (macOS) and smartctl and blkid (Cygwin) to get a comprehensive amount of disk information. This information is available in a structured dictionary for ease of use.

NOTE: Cygwin is supported since v1.1.0, Python 2 is unsupported since v1.0.7.
15
16
17
18
19
20
21
22
23

Features:
---------

Uses the operating system\'s built-in tools to gather lots of helpful information about disks connected to the system. This is returned as a hierarchical python dictionary. For the full details on the format, read the documentation here: https://www.hamishmb.com/html/Docs/getdevinfo.php

Dependencies:
-------------

24
On Linux it requires lshw, blkid, lvdisplay, and blockdev to be installed. On Cygwin, you need the smartmontools and util-linux packages. On Linux and Cygwin, you also need the beautifulsoup4 (bs4), and lxml python packages to use this tool. On macOS, nothing beyond a standard python3.x install is required, but you still need bs4 and lxml if you want to install using the python wheel/through pip.
25
26

Building
27
========
28
29

Source Distribution
30
-------------------
31
32
33
34
35
36

Run:

"python setup.py sdist"

Wheels
37
------
38
39
40

Make sure you've installed the "wheel" package:

41
"pip3 install wheel"
42
43

Universal Wheel
44
---------------
45

46
This is the recommended choice, though GetDevInfo no longer runs on Python 2 from version 1.0.7 onwards,
47

48
"python3 setup.py bdist_wheel --universal"
49
50

Pure Python Wheel
51
-----------------
52
53
54

Not sure why you'd do this, but you can run:

55
"python3 setup.py bdist_wheel"
56
57
58
59
60

to acheive this if you want.


Distribution Packages
61
=====================
62

63
You can find these at https://www.launchpad.net/getdevinfo or https://www.hamishmb.com/html/downloads.php?program_name=getdevinfo.
64

65
66
67
Documentation
=============
This can be found at https://www.hamishmb.com/html/Docs/getdevinfo.php.
68

Hamish McIntyre-Bhatty's avatar
Hamish McIntyre-Bhatty committed
69
70
71
72
73
74
75
76
77
78
79
Running directly from the command line
======================================

Run:

"sudo python3 -m getdevinfo.getdevinfo"

Or (v1.0.8 onwards):

"sudo python3 -m getdevinfo"

80
81
82
Running The Tests
=================

Hamish McIntyre-Bhatty's avatar
Hamish McIntyre-Bhatty committed
83
These have to be run as the superuser/administrator, because low-level access to hardware is required to gather information.
84

85
The process for running these is the same on both Linux and macOS. Note that prior to version 1.0.7, GetDevInfo ran on Python 2 as well.
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

Without Coverage Reporting
--------------------------
Change directory to the getdevinfo subfolder, and run:

"sudo python3 ./tests.py"

With Coverage Reporting
-----------------------
Make sure you have installed Coverage.py using pip or your package manager.

Change directory to the getdevinfo subfolder, and run:

"sudo python3 -m coverage run --rcfile=../.coveragerc ./tests.py"

To run the tests. Then run:

"sudo python3 -m coverage report"

To see the report.