setup.py
author Radek Brich <brich.radek@ifortuna.cz>
Mon, 14 Apr 2014 22:29:07 +0200
changeset 11 d1f08fc9de31
parent 8 c7ae4d2e820c
child 15 497067ee16b7
permissions -rwxr-xr-x
Update prettysize: Add parameter to enable trailing zeros.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
     1
#!/usr/bin/env python3
2
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
from distutils.core import setup
8
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
     4
from distutils.command.bdist_rpm import bdist_rpm
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
     5
import sys
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
     6
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
     7
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
     8
class my_bdist_rpm(bdist_rpm):
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
     9
    def __init__(self, *args, **kwargs):
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    10
        bdist_rpm.__init__(self, *args, **kwargs)
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    11
        self._alter_name()
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    12
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    13
    def _alter_name(self):
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    14
        """Prepend "python-" or "python3-" in package name."""
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    15
        if sys.version_info.major == 3:
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    16
            prefix = 'python3-'
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    17
        else:
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    18
            prefix = 'python-'
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    19
        self.distribution.metadata.name = prefix + self.distribution.metadata.name
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    20
2
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    21
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    22
setup(
8
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    23
    name='pycolib',
2
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    24
    version='0.0.1',
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    25
    description='Library of small auxiliary modules',
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    26
    author='Radek Brich',
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    27
    author_email='radek.brich@devl.cz',
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    28
    url='http://hg.devl.cz/pycolib',
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    29
    packages=['pycolib'],
8
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    30
    cmdclass={'bdist_rpm': my_bdist_rpm},
c7ae4d2e820c Update setup: Adjust package name for RPMs by prepending "python3-" prefix.
Radek Brich <radek.brich@devl.cz>
parents: 7
diff changeset
    31
)
2
d3ffa15f5886 Add ColoredFormatter. Add setup.py.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    32