[tor-commits] [stem/master] Allow setup.py to work with different cwd

atagar at torproject.org atagar at torproject.org
Tue Dec 6 17:52:21 UTC 2016


commit 7b2af7d6810234d3847873df823edee9bae86403
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Dec 5 14:04:52 2016 -0800

    Allow setup.py to work with different cwd
    
    Running our setup.py when this wasn't your cwd failed. Quick fix to account for
    this.
---
 setup.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index 65c790e..3d79742 100644
--- a/setup.py
+++ b/setup.py
@@ -3,11 +3,12 @@
 # See LICENSE for licensing information
 
 import distutils.core
+import os
 import stem
 
 DRY_RUN = True
 SUMMARY = 'Stem is a Python controller library that allows applications to interact with Tor (https://www.torproject.org/).'
-DRY_RUN_SUMMARY = "Ignore this package. This is dry-run release creation to work around PyPI limitations (https://github.com/pypa/packaging-problems/issues/74#issuecomment-260716129)."
+DRY_RUN_SUMMARY = 'Ignore this package. This is dry-run release creation to work around PyPI limitations (https://github.com/pypa/packaging-problems/issues/74#issuecomment-260716129).'
 
 DESCRIPTION = """
 For tutorials and API documentation see `stem's homepage <https://stem.torproject.org/>`_.
@@ -20,7 +21,7 @@ To install you can either use...
 ::
 
   pip install stem
-        
+
 ... or install from the source tarball. Stem supports both the python 2.x and 3.x series. To use its python3 counterpart you simply need to install using that version of python.
 
 ::
@@ -30,6 +31,11 @@ To install you can either use...
 After that, give some `tutorials <https://stem.torproject.org/tutorials.html>`_ a try! For questions or to discuss project ideas we're available on `irc <https://www.torproject.org/about/contact.html.en#irc>`_ and the `tor-dev@ email list <https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev>`_.
 """.strip()
 
+# Ensure this is our cwd, otherwise distutils fails with 'standard file
+# 'setup.py' not found'.
+
+os.chdir(os.path.dirname(os.path.abspath(__file__)))
+
 distutils.core.setup(
   name = 'stem-dry-run' if DRY_RUN else 'stem',
   version = stem.__version__,





More information about the tor-commits mailing list