Factor out setup.
This commit is contained in:
parent
83c3a7bd0d
commit
26548c45e9
1 changed files with 33 additions and 19 deletions
|
@ -54,35 +54,34 @@ class BuildSystem(object):
|
||||||
|
|
||||||
class Pear(BuildSystem):
|
class Pear(BuildSystem):
|
||||||
|
|
||||||
def dist(self):
|
def setup(self):
|
||||||
apt = AptManager(self.session)
|
apt = AptManager(self.session)
|
||||||
apt.install(['php-pear'])
|
apt.install(['php-pear'])
|
||||||
|
|
||||||
|
def dist(self):
|
||||||
|
self.setup()
|
||||||
run_with_build_fixer(self.session, ['pear', 'package'])
|
run_with_build_fixer(self.session, ['pear', 'package'])
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
apt = AptManager(self.session)
|
self.setup()
|
||||||
apt.install(['php-pear'])
|
|
||||||
run_with_build_fixer(self.session, ['pear', 'run-tests'])
|
run_with_build_fixer(self.session, ['pear', 'run-tests'])
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
apt = AptManager(self.session)
|
self.setup()
|
||||||
apt.install(['php-pear'])
|
|
||||||
run_with_build_fixer(self.session, ['pear', 'build'])
|
run_with_build_fixer(self.session, ['pear', 'build'])
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
apt = AptManager(self.session)
|
self.setup()
|
||||||
apt.install(['php-pear'])
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
apt = AptManager(self.session)
|
self.setup()
|
||||||
apt.install(['php-pear'])
|
|
||||||
run_with_build_fixer(self.session, ['pear', 'install'])
|
run_with_build_fixer(self.session, ['pear', 'install'])
|
||||||
|
|
||||||
|
|
||||||
class SetupPy(BuildSystem):
|
class SetupPy(BuildSystem):
|
||||||
|
|
||||||
def prereqs(self):
|
def setup(self):
|
||||||
apt = AptManager(self.session)
|
apt = AptManager(self.session)
|
||||||
apt.install(['python3', 'python3-pip'])
|
apt.install(['python3', 'python3-pip'])
|
||||||
with open('setup.py', 'r') as f:
|
with open('setup.py', 'r') as f:
|
||||||
|
@ -103,19 +102,19 @@ class SetupPy(BuildSystem):
|
||||||
# TODO(jelmer): Install setup_requires
|
# TODO(jelmer): Install setup_requires
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
self.prereqs()
|
self.setup()
|
||||||
self._run_setup(['test'])
|
self._run_setup(['test'])
|
||||||
|
|
||||||
def dist(self):
|
def dist(self):
|
||||||
self.prereqs()
|
self.setup()
|
||||||
self._run_setup(['sdist'])
|
self._run_setup(['sdist'])
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
self.prereqs()
|
self.setup()
|
||||||
self._run_setup(['clean'])
|
self._run_setup(['clean'])
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
self.prereqs()
|
self.setup()
|
||||||
self._run_setup(['install'])
|
self._run_setup(['install'])
|
||||||
|
|
||||||
def _run_setup(self, args):
|
def _run_setup(self, args):
|
||||||
|
@ -163,33 +162,44 @@ class PyProject(BuildSystem):
|
||||||
|
|
||||||
class SetupCfg(BuildSystem):
|
class SetupCfg(BuildSystem):
|
||||||
|
|
||||||
def dist(self):
|
def setup(self):
|
||||||
apt = AptManager(self.session)
|
apt = AptManager(self.session)
|
||||||
apt.install(['python3-pep517', 'python3-pip'])
|
apt.install(['python3-pep517', 'python3-pip'])
|
||||||
|
|
||||||
|
def dist(self):
|
||||||
self.session.check_call(['python3', '-m', 'pep517.build', '-s', '.'])
|
self.session.check_call(['python3', '-m', 'pep517.build', '-s', '.'])
|
||||||
|
|
||||||
|
|
||||||
class NpmPackage(BuildSystem):
|
class NpmPackage(BuildSystem):
|
||||||
|
|
||||||
def dist(self):
|
def setup(self):
|
||||||
apt = AptManager(self.session)
|
apt = AptManager(self.session)
|
||||||
apt.install(['npm'])
|
apt.install(['npm'])
|
||||||
|
|
||||||
|
def dist(self):
|
||||||
|
self.setup()
|
||||||
run_with_build_fixer(self.session, ['npm', 'pack'])
|
run_with_build_fixer(self.session, ['npm', 'pack'])
|
||||||
|
|
||||||
|
|
||||||
class Waf(BuildSystem):
|
class Waf(BuildSystem):
|
||||||
|
|
||||||
def dist(self):
|
def setup(self):
|
||||||
apt = AptManager(self.session)
|
apt = AptManager(self.session)
|
||||||
apt.install(['python3'])
|
apt.install(['python3'])
|
||||||
|
|
||||||
|
def dist(self):
|
||||||
|
self.setup()
|
||||||
run_with_build_fixer(self.session, ['./waf', 'dist'])
|
run_with_build_fixer(self.session, ['./waf', 'dist'])
|
||||||
|
|
||||||
|
|
||||||
class Gem(BuildSystem):
|
class Gem(BuildSystem):
|
||||||
|
|
||||||
def dist(self):
|
def setup(self):
|
||||||
apt = AptManager(self.session)
|
apt = AptManager(self.session)
|
||||||
apt.install(['gem2deb'])
|
apt.install(['gem2deb'])
|
||||||
|
|
||||||
|
def dist(self):
|
||||||
|
self.setup()
|
||||||
gemfiles = [name for name in os.listdir('.') if name.endswith('.gem')]
|
gemfiles = [name for name in os.listdir('.') if name.endswith('.gem')]
|
||||||
if len(gemfiles) > 1:
|
if len(gemfiles) > 1:
|
||||||
logging.warning('More than one gemfile. Trying the first?')
|
logging.warning('More than one gemfile. Trying the first?')
|
||||||
|
@ -198,9 +208,13 @@ class Gem(BuildSystem):
|
||||||
|
|
||||||
class DistInkt(BuildSystem):
|
class DistInkt(BuildSystem):
|
||||||
|
|
||||||
def dist(self):
|
def setup(self):
|
||||||
apt = AptManager(self.session)
|
apt = AptManager(self.session)
|
||||||
apt.install(['libdist-inkt-perl'])
|
apt.install(['libdist-inkt-perl'])
|
||||||
|
|
||||||
|
def dist(self):
|
||||||
|
self.setup()
|
||||||
|
apt = AptManager(self.session)
|
||||||
with open('dist.ini', 'rb') as f:
|
with open('dist.ini', 'rb') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
if not line.startswith(b';;'):
|
if not line.startswith(b';;'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue