Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions unix-ffi/machine/machine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@


def unique_id():
for base in ("/etc", "/var/lib/dbus"):
try:
with open(base + "/machine-id", "rb") as source:
data = source.read(32)
if len(data) == 32:
# unhexlify might not be available
return bytes([int(data[i : i + 2], 16) for i in range(0, 32, 2)])
except OSError as e:
pass
return b"upy-non-unique"
2 changes: 1 addition & 1 deletion unix-ffi/machine/manifest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
metadata(version="0.2.2")
metadata(version="0.2.3")

# Originally written by Paul Sokolovsky.

Expand Down
Loading