summaryrefslogtreecommitdiff
path: root/morphlib/buildsystem.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/buildsystem.py')
-rw-r--r--morphlib/buildsystem.py86
1 files changed, 4 insertions, 82 deletions
diff --git a/morphlib/buildsystem.py b/morphlib/buildsystem.py
index 4655f2ee..5096a7c4 100644
--- a/morphlib/buildsystem.py
+++ b/morphlib/buildsystem.py
@@ -44,15 +44,11 @@ _STRIP_COMMAND = r'''find "$DESTDIR" -type f \
class BuildSystem(object):
- '''An abstraction of an upstream build system.
+ '''Predefined commands for common build systems.
- Some build systems are well known: autotools, for example.
- Others are purely manual: there's a set of commands to run that
- are specific for that project, and (almost) no other project uses them.
- The Linux kernel would be an example of that.
-
- This class provides an abstraction for these, including a method
- to autodetect well known build systems.
+ Some build systems are well known: autotools, for example. We provide
+ pre-defined build commands for these so that they don't need to be copied
+ and pasted many times in the build instructions.
'''
@@ -86,15 +82,6 @@ class BuildSystem(object):
'build-system': self.name,
})
- def used_by_project(self, file_list):
- '''Does a project use this build system?
-
- ``exists`` is a function that returns a boolean telling if a
- filename, relative to the project source directory, exists or not.
-
- '''
- raise NotImplementedError() # pragma: no cover
-
class ManualBuildSystem(BuildSystem):
@@ -102,9 +89,6 @@ class ManualBuildSystem(BuildSystem):
name = 'manual'
- def used_by_project(self, file_list):
- return False
-
class DummyBuildSystem(BuildSystem):
@@ -120,9 +104,6 @@ class DummyBuildSystem(BuildSystem):
self.install_commands = ['echo dummy install']
self.strip_commands = ['echo dummy strip']
- def used_by_project(self, file_list):
- return False
-
class AutotoolsBuildSystem(BuildSystem):
@@ -149,18 +130,6 @@ class AutotoolsBuildSystem(BuildSystem):
]
self.strip_commands = [_STRIP_COMMAND]
- def used_by_project(self, file_list):
- indicators = [
- 'autogen',
- 'autogen.sh',
- 'configure',
- 'configure.ac',
- 'configure.in',
- 'configure.in.in',
- ]
-
- return any(x in file_list for x in indicators)
-
class PythonDistutilsBuildSystem(BuildSystem):
@@ -182,13 +151,6 @@ class PythonDistutilsBuildSystem(BuildSystem):
]
self.strip_commands = [_STRIP_COMMAND]
- def used_by_project(self, file_list):
- indicators = [
- 'setup.py',
- ]
-
- return any(x in file_list for x in indicators)
-
class ExtUtilsMakeMakerBuildSystem(BuildSystem):
@@ -228,12 +190,6 @@ class ExtUtilsMakeMakerBuildSystem(BuildSystem):
]
self.strip_commands = [_STRIP_COMMAND]
- def used_by_project(self, file_list):
- indicators = [
- 'Makefile.PL',
- ]
-
- return any(x in file_list for x in indicators)
class ModuleBuildBuildSystem(BuildSystem):
@@ -265,13 +221,6 @@ class ModuleBuildBuildSystem(BuildSystem):
'./Build install'
]
- def used_by_project(self, file_list):
- indicators = [
- 'Build.PL'
- ]
-
- return any(x in file_list for x in indicators)
-
class CMakeBuildSystem(BuildSystem):
@@ -294,12 +243,6 @@ class CMakeBuildSystem(BuildSystem):
]
self.strip_commands = [_STRIP_COMMAND]
- def used_by_project(self, file_list):
- indicators = [
- 'CMakeLists.txt',
- ]
-
- return any(x in file_list for x in indicators)
class QMakeBuildSystem(BuildSystem):
@@ -322,14 +265,6 @@ class QMakeBuildSystem(BuildSystem):
]
self.strip_commands = [_STRIP_COMMAND]
- def used_by_project(self, file_list):
- indicator = '.pro'
-
- for x in file_list:
- if x.endswith(indicator):
- return True
-
- return False
build_systems = [
ManualBuildSystem(),
@@ -343,19 +278,6 @@ build_systems = [
]
-def detect_build_system(file_list):
- '''Automatically detect the build system, if possible.
-
- If the build system cannot be detected automatically, return None.
- For ``exists`` see the ``BuildSystem.exists`` method.
-
- '''
- for bs in build_systems:
- if bs.used_by_project(file_list):
- return bs
- return None
-
-
def lookup_build_system(name):
'''Return build system that corresponds to the name.