apply pep8 recommandation to setup.py

This commit is contained in:
kakwa 2015-07-10 21:00:19 +02:00
parent 2e85e10f0a
commit b831bc82dc
1 changed files with 51 additions and 39 deletions

View File

@ -7,11 +7,11 @@ import re
import sys import sys
from distutils.core import setup from distutils.core import setup
#some install path variables # some install path variables
sysconfdir = os.getenv("SYSCONFDIR", "/etc") sysconfdir = os.getenv("SYSCONFDIR", "/etc")
datarootdir = os.getenv("DATAROOTDIR", sys.prefix) datarootdir = os.getenv("DATAROOTDIR", sys.prefix)
data_dir = os.path.join(sys.prefix, 'share' ,'ldapcherry') data_dir = os.path.join(sys.prefix, 'share', 'ldapcherry')
small_description = 'A simple web application to manage Ldap entries' small_description = 'A simple web application to manage Ldap entries'
# change requirements according to python version # change requirements according to python version
@ -52,16 +52,15 @@ try:
self.test_suite = True self.test_suite = True
def run_tests(self): def run_tests(self):
#import here, cause outside the eggs aren't loaded # import here, cause outside the eggs aren't loaded
import pytest import pytest
errno = pytest.main(self.test_args) errno = pytest.main(self.test_args)
sys.exit(errno) sys.exit(errno)
except ImportError: except ImportError:
from distutils.core import setup from distutils.core import setup
PyTest = lambda x: x PyTest = lambda x: x
# just a small function to easily install a complete directory # just a small function to easily install a complete directory
def get_list_files(basedir, targetdir): def get_list_files(basedir, targetdir):
return_list = [] return_list = []
@ -74,42 +73,55 @@ def get_list_files(basedir, targetdir):
return return_list return return_list
# add static files and templates in the list of thing to deploy # add static files and templates in the list of thing to deploy
resources_files = get_list_files('resources', resources_files = get_list_files(
os.path.join(datarootdir, 'share', 'ldapcherry')) 'resources',
os.path.join(datarootdir, 'share', 'ldapcherry')
)
# add the configuration files if they don't exist # add the configuration files if they don't exist
if not os.path.exists(os.path.join(sysconfdir, 'ldapcherry')): if not os.path.exists(
resources_files.append(( os.path.join(sysconfdir, 'ldapcherry')):
os.path.join(sysconfdir, 'ldapcherry'), resources_files.append(
[ 'conf/ldapcherry.ini', 'conf/attributes.yml', 'conf/roles.yml'] (
)) os.path.join(sysconfdir, 'ldapcherry'),
[
'conf/ldapcherry.ini',
'conf/attributes.yml',
'conf/roles.yml'
]
)
)
setup( setup(
name = 'ldapcherry', name='ldapcherry',
zip_safe = False, zip_safe=False,
version = '0.0.1', version='0.0.1',
author = 'Pierre-Francois Carpentier', author='Pierre-Francois Carpentier',
author_email = 'carpentier.pf@gmail.com', author_email='carpentier.pf@gmail.com',
packages = ['ldapcherry', 'ldapcherry.backend', 'ldapcherry.ppolicy'], packages=[
data_files = resources_files, 'ldapcherry',
scripts = ['scripts/ldapcherryd'], 'ldapcherry.backend',
url = 'https://github.com/kakwa/ldapcherry', 'ldapcherry.ppolicy'
license = license, ],
description = small_description, data_files=resources_files,
long_description = description, scripts=['scripts/ldapcherryd'],
install_requires = install_requires, url='https://github.com/kakwa/ldapcherry',
tests_require = ['pytest'], license=license,
cmdclass = {'test': PyTest}, description=small_description,
classifiers = [ long_description=description,
'Development Status :: 3 - Alpha', install_requires=install_requires,
'Environment :: Web Environment', tests_require=['pytest', 'pep8'],
'Framework :: CherryPy', cmdclass={'test': PyTest},
'Intended Audience :: System Administrators', classifiers=[
'License :: OSI Approved :: MIT License', 'Development Status :: 3 - Alpha',
'Natural Language :: English', 'Environment :: Web Environment',
'Operating System :: POSIX', 'Framework :: CherryPy',
'Programming Language :: Python', 'Intended Audience :: System Administrators',
'Programming Language :: Python :: 2.7', 'License :: OSI Approved :: MIT License',
'Topic :: Internet :: LDAP' 'Natural Language :: English',
] 'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: LDAP'
],
) )