Don't allow users to publish a package using setup.py upload command and point
them to the release guide.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/525bebc1
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/525bebc1
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/525bebc1

Branch: refs/heads/trunk
Commit: 525bebc11dd73e5db73a08b41c9f28384689df68
Parents: 105b961
Author: Tomaz Muraus <[email protected]>
Authored: Thu Sep 5 12:59:27 2013 +0200
Committer: Tomaz Muraus <[email protected]>
Committed: Thu Sep 5 12:59:27 2013 +0200

----------------------------------------------------------------------
 setup.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/525bebc1/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 8fb78c3..3211f52 100644
--- a/setup.py
+++ b/setup.py
@@ -66,6 +66,17 @@ def read_version_string():
     return version
 
 
+def forbid_publish():
+    argv = sys.argv
+    if 'upload'in argv:
+        print('You shouldn\'t use upload command to upload a release to PyPi. '
+              'You need to manually upload files generated using release.sh '
+              'script.\n'
+              'For more information, see "Making a release section" in the '
+              'documentation')
+        sys.exit(1)
+
+
 class TestCommand(Command):
     description = "run test suite"
     user_options = []
@@ -96,8 +107,8 @@ class TestCommand(Command):
                 unittest2
             except ImportError:
                 print('Python version: %s' % (sys.version))
-                print('Missing "unittest2" library. unittest2 is library is 
needed '
-                      'to run the tests. You can install it using pip: '
+                print('Missing "unittest2" library. unittest2 is library is '
+                      'needed to run the tests. You can install it using pip: '
                       'pip install unittest2')
                 sys.exit(1)
 
@@ -229,6 +240,7 @@ class CoverageCommand(Command):
         cov.save()
         cov.html_report()
 
+forbid_publish()
 
 setup(
     name='apache-libcloud',

Reply via email to