[enh] Add a yolo setup.py

This commit is contained in:
Jérôme Lebleu 2014-05-16 15:35:16 +02:00
parent d40055cbda
commit 4e2f2853d2
2 changed files with 53 additions and 5 deletions

View file

@ -3,13 +3,13 @@
# Public constants defined during build
"""Package's data directory (e.g. /usr/share/moulinette)"""
datadir = %PKGDATADIR%
datadir = '%PKGDATADIR%'
"""Package's library directory (e.g. /usr/lib/moulinette)"""
libdir = %PKGLIBDIR%
libdir = '%PKGLIBDIR%'
"""Locale directory for the package (e.g. /usr/lib/moulinette/locale)"""
localedir = %PKGLOCALEDIR%
"""Locale directory for the package (e.g. /usr/share/moulinette/locale)"""
localedir = '%PKGLOCALEDIR%'
"""Cache directory for the package (e.g. /var/cache/moulinette)"""
cachedir = %PKGCACHEDIR%
cachedir = '%PKGCACHEDIR%'

48
setup.py Executable file
View file

@ -0,0 +1,48 @@
#!/usr/bin/env python
import os
import sys
from distutils.core import setup
from distutils.dir_util import mkpath
from distutils.sysconfig import PREFIX
# Define package directories
datadir = os.path.join(PREFIX, 'share/moulinette')
libdir = os.path.join(PREFIX, 'lib/moulinette')
localedir = os.path.join(datadir, 'locale')
cachedir = '/var/cache/moulinette'
# Extend installation
locale_files = []
if "install" in sys.argv:
# Evaluate locale files
for f in os.listdir('locales'):
if f.endswith('.json'):
locale_files.append('locales/%s' % f)
# Generate package.py
package = open('moulinette/package.py.in').read()
package = package.replace('%PKGDATADIR%', datadir) \
.replace('%PKGLIBDIR%', libdir) \
.replace('%PKGLOCALEDIR%', localedir) \
.replace('%PKGCACHEDIR%', cachedir)
with open('moulinette/package.py', 'w') as f:
f.write(package)
# Create needed directories
mkpath(libdir, mode=0755, verbose=1)
mkpath(os.path.join(datadir, 'actionsmap'), mode=0755, verbose=1)
setup(name='Moulinette',
version='2.0.0',
description='',
author='Yunohost Team',
author_email='yunohost@yunohost.org',
url='http://yunohost.org',
license='AGPL',
packages=['moulinette',
'moulinette.authenticators',
'moulinette.interfaces'],
data_files=[(localedir, locale_files)]
)