1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-26 03:04:30 +01:00
This commit is contained in:
kakwa 2015-07-20 00:41:51 +02:00
commit 5a8e5b0123
3 changed files with 38 additions and 8 deletions

View File

@ -41,7 +41,7 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'LdapCherry - Performance Test Framework' project = u'LdapCherry - Directory Management Interface'
copyright = u'2014, Pierre-Francois Carpentier' copyright = u'2014, Pierre-Francois Carpentier'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
@ -165,3 +165,17 @@ html_file_suffix = ".html"
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'LdapCherry-docs' htmlhelp_basename = 'LdapCherry-docs'
try:
from unittest.mock import MagicMock
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return Mock()
MOCK_MODULES = ['cherrypy']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
except Exception as e:
print("No Mock of cherrypy")
print(str(e))
pass

4
requirements.txt Normal file
View File

@ -0,0 +1,4 @@
CherryPy>=3.0.0
PyYAML
Mako
python-ldap

View File

@ -5,13 +5,16 @@
import os import os
import re import re
import sys import sys
from distutils.core import setup from distutils.core import setup, run_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", os.path.join(sys.prefix, 'share'))
data_dir = os.path.join(sys.prefix, 'share', 'ldapcherry') # path to install data
data_dir = os.path.join(datarootdir, 'ldapcherry')
# path to install configuration
config_dir = os.path.join(sysconfdir, '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
@ -63,6 +66,13 @@ except ImportError:
x x
def as_option_root():
for arg in sys.argv:
if re.match(r'--root.*', arg):
return True
return False
# 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 = []
@ -77,15 +87,16 @@ def get_list_files(basedir, targetdir):
# 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_files = get_list_files(
'resources', 'resources',
os.path.join(datarootdir, 'share', 'ldapcherry') data_dir,
) )
as_option_root
# add the configuration files if they don't exist # add the configuration files if they don't exist
if not os.path.exists( if as_option_root() or not os.path.exists(
os.path.join(sysconfdir, 'ldapcherry')): config_dir):
resources_files.append( resources_files.append(
( (
os.path.join(sysconfdir, 'ldapcherry'), config_dir,
[ [
'conf/ldapcherry.ini', 'conf/ldapcherry.ini',
'conf/attributes.yml', 'conf/attributes.yml',
@ -94,6 +105,7 @@ if not os.path.exists(
) )
) )
setup( setup(
name='ldapcherry', name='ldapcherry',
zip_safe=False, zip_safe=False,