# HG changeset patch # User Radek Brich # Date 1376914629 -7200 # Node ID c7ae4d2e820cd24dd7d6afd2e3bc56a15845023a # Parent 776ba4914dfc270ea63fc8ff3cf9ec7a3e09bfd8 Update setup: Adjust package name for RPMs by prepending "python3-" prefix. diff -r 776ba4914dfc -r c7ae4d2e820c setup.py --- a/setup.py Fri Aug 16 13:23:49 2013 +0200 +++ b/setup.py Mon Aug 19 14:17:09 2013 +0200 @@ -1,14 +1,32 @@ -#!/usr/bin/env python3.2 +#!/usr/bin/env python3 from distutils.core import setup +from distutils.command.bdist_rpm import bdist_rpm +import sys + + +class my_bdist_rpm(bdist_rpm): + def __init__(self, *args, **kwargs): + bdist_rpm.__init__(self, *args, **kwargs) + self._alter_name() + + def _alter_name(self): + """Prepend "python-" or "python3-" in package name.""" + if sys.version_info.major == 3: + prefix = 'python3-' + else: + prefix = 'python-' + self.distribution.metadata.name = prefix + self.distribution.metadata.name + setup( - name='python3-pycolib', + name='pycolib', version='0.0.1', description='Library of small auxiliary modules', author='Radek Brich', author_email='radek.brich@devl.cz', url='http://hg.devl.cz/pycolib', packages=['pycolib'], - ) + cmdclass={'bdist_rpm': my_bdist_rpm}, +)