• Description
  • Patches
id

3

publisher

goffi@goffi.org/c239cac5-e347-4380-a8b2-829444574ebb

title
Instal sat_templates the python's way
author
Xavier
created
2017-12-30T13:39:22Z
updated
2018-06-02T15:32:14Z
labels
status
closed
body

You can just call 'pip install .' to install sat_templates.

comments_uri
xmpp:pubsub.goffi.org?;node=urn%3Axmpp%3Amicroblog%3A0%3Acomments%2Forg.salut-a-toi.merge_requests%3A0_dGRrdbhBkZ6u7QujjeS43f
Hello and thanks for your contribution. The installation doesn't keep the dir hierarchy ("default" dir is removed), and this is needed for template system. Also I don't think that "get_data_templates_files" function is needed as setuptools already provide necessary mechanism with "find_packages". So I can't merge this MR in this current state.
To speed up things, I've merged your patch, and done a new one just after to do the small fixes needed. It's working, thanks for your contribution ! closing this MR now.

You are not logged. You need to log in to comment.

Xavier Maillard

Instal sat_templates the python's way You can just call 'pip install .' to install sat_templates.

diff --git a/setup.py b/setup.py
new file mode 100644
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+# SàT templates: collection of templates 
+# Copyright (C) 2017  Xavier Maillard (xavier@maillard.im)
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+from setuptools import setup, find_packages
+
+base = None
+NAME = 'sat_templates'
+is_wheel = 'bdist_wheel' in sys.argv
+
+# https://stackoverflow.com/a/36693250
+
+def get_data_templates_files(directory):
+    paths = []
+    for (path, directories, filenames) in os.walk(directory):
+	for filename in filenames:
+		paths.append(os.path.join('..', path, filename))
+    return paths
+
+data_templates_files = get_data_templates_files('default')
+
+setup_info = dict(
+    name=NAME,
+    version= '0.7D',
+    author='Association « Salut à Toi »',
+    author_email='contact@salut-a-toi.org',
+    url='https://salut-a-toi.org',
+    classifiers=['Development Status :: 3 - Alpha',
+                 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
+                 'Operating System :: POSIX :: Linux',
+                 'Topic :: Communications :: Chat'],
+    install_requires=[],
+    packages=['sat_templates'],
+    package_dir={'sat_templates':'default'},
+    package_data={'': data_templates_files },
+    data_files=[(os.path.join(sys.prefix, 'share/locale/fr/LC_MESSAGES'), ['i18n/fr/LC_MESSAGES/sat.mo']),
+                  ('share/doc/%s' % NAME, ['COPYING']),
+                  ],
+    zip_safe=True,
+)
+
+setup(**setup_info)