aboutsummaryrefslogtreecommitdiffstats
path: root/moon_manager/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'moon_manager/setup.py')
-rw-r--r--moon_manager/setup.py76
1 files changed, 69 insertions, 7 deletions
diff --git a/moon_manager/setup.py b/moon_manager/setup.py
index 35c944c3..6fad66c9 100644
--- a/moon_manager/setup.py
+++ b/moon_manager/setup.py
@@ -1,12 +1,59 @@
-# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
-# This software is distributed under the terms and conditions of the 'Apache-2.0'
-# license which can be found in the file 'LICENSE' in this package distribution
-# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
+# Software Name: MOON
+# Version: 5.4
+
+# SPDX-FileCopyrightText: Copyright (c) 2018-2020 Orange and its contributors
+# SPDX-License-Identifier: Apache-2.0
+
+# This software is distributed under the 'Apache License 2.0',
+# the text of which is available at 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+# or see the "LICENSE" file for more details.
+
+
+import os
+import shutil
from setuptools import setup, find_packages
+from setuptools.command.install import install
+from setuptools.command.develop import develop
import moon_manager
+def initConfiguration():
+ if os.name == "posix":
+ try:
+ os.mkdir("/etc/moon")
+ except FileExistsError:
+ pass
+ if not os.path.exists(os.path.join("/etc", "moon", "moon.yaml")):
+ print("Installing configuration file in /etc")
+ shutil.copy(os.path.join("conf", "moon.yaml"),
+ os.path.join("/etc", "moon"))
+ # else:
+ # raise NotImplementedError('You should install configuration file somewhere '
+ # 'on your system')
+
+
+class CustomInstallCommand(install):
+ """Customized setuptools install command - install configuration file in etc."""
+
+ def run(self):
+ install.run(self)
+ initConfiguration()
+
+
+class CustomDevelopCommand(develop):
+ """Customized setuptools develop command - install configuration file in etc."""
+
+ def run(self):
+ develop.run(self)
+ initConfiguration()
+ with open('requirements.txt') as f:
+ requirements = filter(
+ lambda s: (len(s)>0 and s.strip()[0]!='#'),
+ f.read().split('\n'))
+ print('requirements', requirements)
+
+
setup(
name='moon_manager',
@@ -23,11 +70,24 @@ setup(
long_description=open('README.md').read(),
- # install_requires= ,
+ install_requires=list(filter(
+ lambda s: (len(s) > 0 and s.strip()[0] != '#'),
+ open('requirements.txt').read().split('\n'))),
+
+ data_files=[
+ ("moon", ["conf/moon.yaml"]),
+ ("moon", ["moonrc"])
+ ],
+
include_package_data=True,
- url='https://git.opnfv.org/cgit/moon',
+ cmdclass={
+ 'develop': CustomDevelopCommand,
+ 'install': CustomInstallCommand,
+ },
+
+ url='',
classifiers=[
"Programming Language :: Python",
@@ -40,8 +100,10 @@ setup(
entry_points={
'console_scripts': [
- 'moon_manager = moon_manager.server:create_server',
+ 'moon_manager = moon_manager.__main__:run',
+ 'moon_manager_setup = moon_manager.manager_setup:setup'
],
+
}
)