File: manage.py

package info (click to toggle)
plainbox-provider-resource-generic 0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 532 kB
  • ctags: 60
  • sloc: sh: 1,273; python: 811; ansic: 173; makefile: 19
file content (50 lines) | stat: -rwxr-xr-x 1,680 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
import os
import shutil
import subprocess

from plainbox.provider_manager import N_
from plainbox.provider_manager import SourceDistributionCommand
from plainbox.provider_manager import manage_py_extension
from plainbox.provider_manager import setup


@manage_py_extension
class SourceDistributionCommandExt(SourceDistributionCommand):
    # Overridden version of SourceDistributionCommand that handles autotools
    __doc__ = SourceDistributionCommand.__doc__
    _INCLUDED_ITEMS = SourceDistributionCommand._INCLUDED_ITEMS + ['COPYING']
    _GENERATED_ITEMS = [
        'INSTALL',
        'Makefile.in',
        'aclocal.m4',
        'compile',
        'config.h.in',
        'configure',
        'depcomp',
        'install-sh',
        'missing',
    ]

    @property
    def src_dir(self):
        return os.path.join(self.definition.location, "src")

    def invoked(self, ns):
        # Update the configure script
        subprocess.check_call(['autoreconf', '-i'], cwd=self.src_dir)
        # Remove autom4te.cache, we don't need it in our source tarballs
        # http://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Autom4te-Cache.html
        shutil.rmtree(os.path.join(self.src_dir, 'autom4te.cache'))
        # Generate the source tarball
        super().invoked(ns)
        # Remove generated autotools stuff
        for item in self._GENERATED_ITEMS:
            os.remove(os.path.join(self.src_dir, item))

setup(
    name='2013.com.canonical.certification:plainbox-resources',
    version="0.3",
    description=N_("PlainBox resources provider"),
    gettext_domain='2013.com.canonical.certification.plainbox-resources',
)