File: setup.py

package info (click to toggle)
canto 0.7.10-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 700 kB
  • sloc: python: 6,384; ansic: 281; makefile: 20; sh: 19
file content (59 lines) | stat: -rwxr-xr-x 2,438 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
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
from __future__ import with_statement # This isn't required in Python 2.6
import commands
import distutils.core
import distutils.command.install_data
import uninstall
version = ['0','7','10']
man_date = "27 July 2010"
git_commit = commands.getoutput("git show --pretty=oneline\
        --abbrev-commit").split()[0]

# TODO: replace with build_manpages target (@james will do this shortly if approved)
class Canto_install_data(distutils.command.install_data.install_data):
    def run(self):
        ret = distutils.command.install_data.install_data.run(self)

        install_cmd = self.get_finalized_command('install')
        libdir = install_cmd.install_lib
        mandir = install_cmd.install_data + "/share/man/man1/"

        for source in ["/canto/const.py"]:
            with open(libdir + source, "r+") as f:
                d = f.read().replace("SET_VERSION_TUPLE","(" +\
					",".join(version) + ")")
                d = d.replace("SET_GIT_SHA", "\"" + git_commit + "\"")
                f.truncate(0)
                f.seek(0)
                f.write(d)

        for manpage in ["canto.1","canto-fetch.1","canto-inspect.1"]:
            with open(mandir + manpage, "r+") as f:
                d = f.read().replace("MAN_VERSION", ".".join(version))
                d = d.replace("MAN_DATE", man_date)
                f.truncate(0)
                f.seek(0)
                f.write(d)

distutils.core.setup(name='Canto',
        version=".".join(version),
        description='An ncurses RSS aggregator.',
        author='Jack Miller',
        author_email='jack@codezen.org',
        url='http://codezen.org/canto',
        download_url='http://codezen.org/static/canto-' + ".".join(version) + ".tar.gz",
        platforms=["linux"],
        license='GPLv2',
        scripts=['bin/canto','bin/canto-fetch', 'bin/canto-inspect'],
        packages=['canto', 'canto.cfg'],
        ext_modules=[distutils.core.Extension('canto.widecurse',\
                sources = ['canto/widecurse.c'], libraries = ['ncursesw'],
                library_dirs=["/usr/local/lib", "/opt/local/lib"],
                include_dirs=["/usr/local/include", "/opt/local/include"])],
        data_files = [("share/man/man1/",\
                ["man/canto.1", "man/canto-fetch.1", "man/canto-inspect.1"])],
        cmdclass={
		'install_data': Canto_install_data,
		'install': uninstall.install, 'uninstall': uninstall.uninstall
	}
)