Adding (un-unit-tested) watchrepo support.
[margebot.git] / setup.py
index 7a5bb92..06eac90 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,39 @@
 Setup.py
 """
 # pragma pylint: disable=invalid-name
+from distutils.errors import DistutilsSetupError
+from distutils.filelist import FileList
+import os
 from setuptools import setup
+import setuptools.command.sdist
+import setuptools.command.upload
+import setuptools.command.install
+
+# Errbot plugins aren't distributed as eggs so stub out the sdist, install and upload commands
+
+class ErrbotSdistCommand(setuptools.command.sdist.sdist):
+    """
+    No sdist command for now.
+    """
+    def run(self):
+        raise DistutilsSetupError("No sdist for Errbot plugins.")
+
+
+class ErrbotUploadCommand(setuptools.command.upload.upload):
+    """
+    Don't try uploading Errbot plugins to pypi
+    """
+    def run(self):
+        raise DistutilsSetupError("No uploading Errbot plugins to pypi.")
+
+
+class ErrbotInstallCommand(setuptools.command.install.install):
+    """
+    Short circuit the install command
+    """
+    def run(self): 
+        raise DistutilsSetupError("No install command - copy the ./plugin files to a 'Marge' directory under your Errbot's plugins directory.")
+
 
 with open('requirements.txt') as f:
     install_required = f.read().splitlines()
@@ -11,25 +43,24 @@ with open('test-requirements.txt') as f:
     tests_required = f.read().splitlines()
 
 setup(
-    name='Margebot',
+    name='Marge',
     version='1.0.0',
-    # packages=['plugins'],
-    data_files=[('/opt/errbot/plugins/Marge',
-                 ['./plugins/marge.plug',
-                  './plugins/marge.py',
-                  './plugins//templates/reviews.md',
-                  'README.md',
-                  'LICENCE'])],
     license='GPLv3',
     description='A Errbot plugin for reminding you about outstanding Gitlab merge requests',
     long_description=open('README.md').read(),
     url='https://pwan.org/git/?p=margebot.git;a=summary',
     author='JudeN',
     author_email='margebot_spam@pwan.org',
-    include_package_data=True,
 
+    include_package_data=True,
     install_requires=install_required,
 
     setup_requires=['pytest-runner'],
     tests_require=tests_required,
+
+    cmdclass={
+        'install' : ErrbotInstallCommand,
+        'sdist' : ErrbotSdistCommand,
+        'upload' : ErrbotUploadCommand,
+    }
 )