adding setuptools to setup.py

This commit is contained in:
volpino 2012-03-27 18:45:35 +02:00
parent 5062f29e3c
commit 9814b81797
2 changed files with 22 additions and 13 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
*~ *~
*.pyc *.py[co]
euscanwww/rrd/*.rrd euscanwww/rrd/*.rrd
euscanwww/media/charts/*.png euscanwww/media/charts/*.png
*.egg-info

View File

@ -4,8 +4,11 @@ from __future__ import print_function
import re import re
import sys import sys
import distutils from distutils import log
from distutils import core, log try:
from setuptools import setup, Command
except ImportError:
from distutils.core import setup, Command
from glob import glob from glob import glob
import os import os
@ -21,27 +24,29 @@ cwd = os.getcwd()
try: try:
from portage.const import EPREFIX from portage.const import EPREFIX
except ImportError: except ImportError:
EPREFIX='' EPREFIX = ''
# Python files that need `__version__ = ""` subbed, relative to this dir: # Python files that need `__version__ = ""` subbed, relative to this dir:
python_scripts = [os.path.join(cwd, path) for path in ( python_scripts = [os.path.join(cwd, path) for path in (
'bin/euscan', 'bin/euscan',
)] )]
class set_version(core.Command):
class set_version(Command):
"""Set python __version__ to our __version__.""" """Set python __version__ to our __version__."""
description = "hardcode scripts' version using VERSION from environment" description = "hardcode scripts' version using VERSION from environment"
user_options = [] # [(long_name, short_name, desc),] user_options = [] # [(long_name, short_name, desc),]
def initialize_options (self): def initialize_options(self):
pass pass
def finalize_options (self): def finalize_options(self):
pass pass
def run(self): def run(self):
ver = 'git' if __version__ == '9999' else __version__ ver = 'git' if __version__ == '9999' else __version__
print("Settings version to %s" % ver) print("Settings version to %s" % ver)
def sub(files, pattern): def sub(files, pattern):
for f in files: for f in files:
updated_file = [] updated_file = []
@ -63,7 +68,7 @@ packages = [
if '__init__.py' in files if '__init__.py' in files
] ]
core.setup( setup(
name='euscan', name='euscan',
version=__version__, version=__version__,
description='Ebuild upstream scan utility.', description='Ebuild upstream scan utility.',
@ -72,16 +77,19 @@ core.setup(
maintainer='Corentin Chary', maintainer='Corentin Chary',
maintainer_email='corentin.chary@gmail.com', maintainer_email='corentin.chary@gmail.com',
url='http://euscan.iksaif.net', url='http://euscan.iksaif.net',
download_url='https://github.com/iksaif/euscan/tarball/' + ('master' if __version__ == '9999' else ('euscan-%s' % __version__)), download_url=(
'https://github.com/iksaif/euscan/tarball/' +
('master' if __version__ == '9999' else ('euscan-%s' % __version__))
),
package_dir={'': 'pym'}, package_dir={'': 'pym'},
packages=packages, packages=packages,
package_data = {}, package_data={},
scripts=python_scripts, scripts=python_scripts,
data_files=( data_files=(
(os.path.join(os.sep, EPREFIX.lstrip(os.sep), 'usr/share/man/man1'), glob('man/*')), (os.path.join(os.sep, EPREFIX.lstrip(os.sep), 'usr/share/man/man1'),
glob('man/*')),
), ),
cmdclass={ cmdclass={
'set_version': set_version, 'set_version': set_version,
}, },
) )