From 5182e8154b2000f9a55c34823a47a5b164a59e82 Mon Sep 17 00:00:00 2001 From: r00t Date: Tue, 8 May 2018 23:41:42 -0400 Subject: [PATCH] __init__.py handling proper checks updated .gitignore too --- .gitignore | 2 +- TODO | 14 ++++++++++++++ bdisk/__init__.py | 27 +++++++++++++++++++++++++++ bdisk/main.py | 4 ++++ bdisk/utils.py | 0 5 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 TODO create mode 100644 bdisk/utils.py diff --git a/.gitignore b/.gitignore index f08e2c9..687bbd5 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,4 @@ screenlog* # and we DEFINITELY don't need these. __pycache__/ *.pyc -bdisk/test.py +test.py diff --git a/TODO b/TODO new file mode 100644 index 0000000..7f0e725 --- /dev/null +++ b/TODO @@ -0,0 +1,14 @@ +- write classes/functions +- support XML and legacy build.ini (warn to STDERR for build.ini) + + +BUGS.SQUARE-R00T.NET bugs/tasks: +#7: Ensure conditional deps/imports for features only if used. + Is this setup.py-compatible? +#14: Use os.path.join() for more consistency/pythonicness +#24: Run as regular user? (pychroot? fakeroot?) +#34: Build-time support for only building single phase of build +#36: Allow parsing pkg lists with inline comments +#39: Fix UEFI +#40: ISO overlay (to add e.g. memtest86+ to final ISO) +#43: Support resuming partial tarball downloads (Accet-Ranges: bytes) \ No newline at end of file diff --git a/bdisk/__init__.py b/bdisk/__init__.py index e69de29..9f0a3c3 100644 --- a/bdisk/__init__.py +++ b/bdisk/__init__.py @@ -0,0 +1,27 @@ +import os +import platform +import sys + + +# BDisk is only supported on Python 3.4 and up. +if sys.version_info.major != 3: + raise RuntimeError('BDisk is only supported on Python 3') +elif sys.version_info.minor <= 3: + raise RuntimeError('BDisk is only supported on Python 3.4 and up') + +# BDisk is only supported on GNU/Linux. There *might* be a way to make it work +# with certain *BSDs, but if that's possible at all it'll have to come at a +# later date. Patches welcome. +# I'd have to find out how to manipulate/create FAT filesystems and such as +# well. +# I'd be curious to see if I can get it working in Cygwin or WSL: +# https://docs.microsoft.com/en-us/windows/wsl/install-win10 +# And maybe, if we're really pie-in-the-sky, macOS's Fink/Homebrew/Macports. +if platform.system() != 'Linux': + raise RuntimeError('BDisk is currently only supported on GNU/Linux') + +# CURRENTLY, we require root user because of the chroots and such. However, +# there should be creative ways to do this with cgroups as a regular user in +# the future. Patches welcome (or at least some input). +if os.geteuid() != 0: + raise PermissionError('BDisk currently requires root privileges') diff --git a/bdisk/main.py b/bdisk/main.py index e69de29..29287f1 100644 --- a/bdisk/main.py +++ b/bdisk/main.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3.6 + +def main(): + pass diff --git a/bdisk/utils.py b/bdisk/utils.py new file mode 100644 index 0000000..e69de29