Commits

Michał Górny committed ba3904d

Move bootloaders into subpackage.

  • Participants
  • Parent commits 095f651

Comments (0)

Files changed (13)

File ecleankernel/bootloader/__init__.py

Empty file added.

File ecleankernel/bootloader/grub.py

+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+from __future__ import print_function
+
+import os.path, re
+
+def get_grub_kernels(debug):
+	kernel_re = re.compile(r'^\s*kernel\s*(\([^)]+\))?(\S+)',
+			re.MULTILINE | re.IGNORECASE)
+
+	f = open('/boot/grub/grub.conf')
+	debug.print('grub.conf found')
+
+	def _get_kernels(f):
+		debug.indent(heading = 'matching grub.conf')
+		try:
+			for m in kernel_re.finditer(f.read()):
+				path = m.group(2)
+				debug.printf('regexp matched path %s', path)
+				debug.indent()
+				debug.printf('from line: %s', m.group(0))
+				if os.path.relpath(path, '/boot').startswith('..'):
+					path = os.path.join('/boot', os.path.relpath(path, '/'))
+					debug.printf('appending /boot, path now: %s', path)
+				debug.outdent()
+				yield path
+		finally:
+			debug.outdent()
+			f.close()
+
+	return _get_kernels(f)

File ecleankernel/bootloader/grub2.py

+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+from __future__ import print_function
+
+import os.path, re
+
+def get_grub2_kernels(debug):
+	kernel_re = re.compile(r'^\s*linux\s*(\([^)]+\))?(\S+)',
+			re.MULTILINE | re.IGNORECASE)
+
+	f = open('/boot/grub/grub.cfg')
+	debug.print('grub.cfg found')
+
+	def _get_kernels(f):
+		debug.indent(heading = 'matching grub.cfg')
+		try:
+			for m in kernel_re.finditer(f.read()):
+				path = m.group(2)
+				debug.printf('regexp matched path %s', path)
+				debug.indent()
+				debug.printf('from line: %s', m.group(0))
+				if os.path.relpath(path, '/boot').startswith('..'):
+					path = os.path.join('/boot', os.path.relpath(path, '/'))
+					debug.printf('appending /boot, path now: %s', path)
+				debug.outdent()
+				yield path
+		finally:
+			debug.outdent()
+			f.close()
+
+	return _get_kernels(f)

File ecleankernel/bootloader/lilo.py

+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+import re
+
+def get_lilo_kernels(debug = False):
+	kernel_re = re.compile(r'^\s*image\s*=\s*(.+)\s*$',
+			re.MULTILINE | re.IGNORECASE)
+
+	f = open('/etc/lilo.conf')
+
+	def _get_kernels(f):
+		try:
+			for m in kernel_re.finditer(f.read()):
+				yield m.group(1)
+		finally:
+			f.close()
+
+	return _get_kernels(f)

File ecleankernel/bootloader/symlinks.py

+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+import os.path
+
+def get_vmlinuz_symlinks(debug = False):
+	for fn in ('vmlinuz', 'vmlinux', 'kernel', 'bzImage'):
+		for suffix in ('', '.old'):
+			f = '/boot/%s%s' % (fn, suffix)
+			if os.path.exists(f):
+				yield f

File ecleankernel/bootloader/yaboot.py

+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+import re
+
+def get_yaboot_kernels(debug = False):
+	kernel_re = re.compile(r'^\s*image\s*=\s*(.+)\s*$',
+			re.MULTILINE | re.IGNORECASE)
+
+	f = open('/etc/yaboot.conf')
+
+	def _get_kernels(f):
+		try:
+			for m in kernel_re.finditer(f.read()):
+				yield m.group(1)
+		finally:
+			f.close()
+
+	return _get_kernels(f)

File ecleankernel/grub.py

-#	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
-# Released under the terms of the 2-clause BSD license.
-
-from __future__ import print_function
-
-import os.path, re
-
-def get_grub_kernels(debug):
-	kernel_re = re.compile(r'^\s*kernel\s*(\([^)]+\))?(\S+)',
-			re.MULTILINE | re.IGNORECASE)
-
-	f = open('/boot/grub/grub.conf')
-	debug.print('grub.conf found')
-
-	def _get_kernels(f):
-		debug.indent(heading = 'matching grub.conf')
-		try:
-			for m in kernel_re.finditer(f.read()):
-				path = m.group(2)
-				debug.printf('regexp matched path %s', path)
-				debug.indent()
-				debug.printf('from line: %s', m.group(0))
-				if os.path.relpath(path, '/boot').startswith('..'):
-					path = os.path.join('/boot', os.path.relpath(path, '/'))
-					debug.printf('appending /boot, path now: %s', path)
-				debug.outdent()
-				yield path
-		finally:
-			debug.outdent()
-			f.close()
-
-	return _get_kernels(f)

File ecleankernel/grub2.py

-#	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
-# Released under the terms of the 2-clause BSD license.
-
-from __future__ import print_function
-
-import os.path, re
-
-def get_grub2_kernels(debug):
-	kernel_re = re.compile(r'^\s*linux\s*(\([^)]+\))?(\S+)',
-			re.MULTILINE | re.IGNORECASE)
-
-	f = open('/boot/grub/grub.cfg')
-	debug.print('grub.cfg found')
-
-	def _get_kernels(f):
-		debug.indent(heading = 'matching grub.cfg')
-		try:
-			for m in kernel_re.finditer(f.read()):
-				path = m.group(2)
-				debug.printf('regexp matched path %s', path)
-				debug.indent()
-				debug.printf('from line: %s', m.group(0))
-				if os.path.relpath(path, '/boot').startswith('..'):
-					path = os.path.join('/boot', os.path.relpath(path, '/'))
-					debug.printf('appending /boot, path now: %s', path)
-				debug.outdent()
-				yield path
-		finally:
-			debug.outdent()
-			f.close()
-
-	return _get_kernels(f)

File ecleankernel/lilo.py

-#	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
-# Released under the terms of the 2-clause BSD license.
-
-import re
-
-def get_lilo_kernels(debug = False):
-	kernel_re = re.compile(r'^\s*image\s*=\s*(.+)\s*$',
-			re.MULTILINE | re.IGNORECASE)
-
-	f = open('/etc/lilo.conf')
-
-	def _get_kernels(f):
-		try:
-			for m in kernel_re.finditer(f.read()):
-				yield m.group(1)
-		finally:
-			f.close()
-
-	return _get_kernels(f)

File ecleankernel/process.py

 
 import errno, os, os.path, re
 
-from .grub import get_grub_kernels
-from .grub2 import get_grub2_kernels
-from .lilo import get_lilo_kernels
-from .yaboot import get_yaboot_kernels
-from .symlinks import get_vmlinuz_symlinks
+from .bootloader.grub import get_grub_kernels
+from .bootloader.grub2 import get_grub2_kernels
+from .bootloader.lilo import get_lilo_kernels
+from .bootloader.yaboot import get_yaboot_kernels
+from .bootloader.symlinks import get_vmlinuz_symlinks
 
 bootloaders = (
 	('lilo', get_lilo_kernels),

File ecleankernel/symlinks.py

-#	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
-# Released under the terms of the 2-clause BSD license.
-
-import os.path
-
-def get_vmlinuz_symlinks(debug = False):
-	for fn in ('vmlinuz', 'vmlinux', 'kernel', 'bzImage'):
-		for suffix in ('', '.old'):
-			f = '/boot/%s%s' % (fn, suffix)
-			if os.path.exists(f):
-				yield f

File ecleankernel/yaboot.py

-#	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
-# Released under the terms of the 2-clause BSD license.
-
-import re
-
-def get_yaboot_kernels(debug = False):
-	kernel_re = re.compile(r'^\s*image\s*=\s*(.+)\s*$',
-			re.MULTILINE | re.IGNORECASE)
-
-	f = open('/etc/yaboot.conf')
-
-	def _get_kernels(f):
-		try:
-			for m in kernel_re.finditer(f.read()):
-				yield m.group(1)
-		finally:
-			f.close()
-
-	return _get_kernels(f)
 		author_email = 'mgorny@gentoo.org',
 		url = 'http://github.com/mgorny/eclean-kernel',
 
-		packages = ['ecleankernel'],
+		packages = ['ecleankernel', 'ecleankernel.bootloader'],
 		scripts = ['eclean-kernel'],
 
 		classifiers = [