__init__.py handling proper checks

updated .gitignore too
This commit is contained in:
brent s. 2018-05-08 23:41:42 -04:00
parent c6a837d1fe
commit 5182e8154b
5 changed files with 46 additions and 1 deletions

2
.gitignore vendored
View File

@ -26,4 +26,4 @@ screenlog*
# and we DEFINITELY don't need these.
__pycache__/
*.pyc
bdisk/test.py
test.py

14
TODO Normal file
View File

@ -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)

View File

@ -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')

View File

@ -0,0 +1,4 @@
#!/usr/bin/env python3.6

def main():
pass

0
bdisk/utils.py Normal file
View File