From a6d4d942c32b995774e6db3529f17ec19060a1de Mon Sep 17 00:00:00 2001 From: mjaworski Date: Mon, 25 Jan 2016 14:43:08 +0100 Subject: [PATCH] some cleanup and hilarious version hack --- README.md | 12 ++++++------ setup.py | 21 ++++++++++++++++----- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a727655..ac631dc 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,10 @@ your current environment. pip install requirements-dev.txt This package was made only for trolling so do not expect it to work. It may -work on Linux and Mac OS X but was not extensively tested. Also this is only -a one-shot fix. Once you did the mistake it will try to fix it but once -installed this package is installed will not help you anymore. +work on Linux and Mac OS X but was not extensively tested. It is also a +one-shot trick so no updates will be installed once you do that unless you +specify a `-U` or `--update` switch. Happy debugging! -PyPI (fortunately) does not allow to upload package named `requirements.txt` so the -only supported name is currently a `requirements-dev.txt`. It still should be -quite popular though. +PyPI (fortunately) does not allow to upload package named `requirements.txt` so +the only supported name is currently a `requirements-dev.txt`. It still should +be quite popular though. diff --git a/setup.py b/setup.py index 9565dbb..aea6f7b 100644 --- a/setup.py +++ b/setup.py @@ -69,14 +69,13 @@ def guess_tty(self): raise AnotherRageQuit("So close ...") - def do_barell_roll(self, msg, tty): - with open(tty, 'w') as stdout: - print >> stdout, msg - def set_pun(self): cwd = self.guess_cwd() tty = self.guess_tty() + # bypass the fact that pip intercepts all stdout from setup.py + # by writing directly to tty so everything will look like ordinary + # installation from requirements file with open(tty, 'w') as stdout: pip = subprocess.Popen( ['pip', 'install', @@ -113,9 +112,21 @@ def read_md(f): README = os.path.join(os.path.dirname(__file__), 'README.md') + +def version(ver): + """ Hilarious hack that makes this package installed on fake version + + This causes package to be installed on every subsequent pip install call + """ + flat_argv = " ".join(sys.argv) + return '0.0.0' if ( + 'install' in flat_argv or 'develop' in flat_argv + ) else ver + + setup( name='requirements-dev.txt', - version="0.0.5", + version=version("0.0.6"), author='MichaƂ Jaworski', author_email='swistakm@gmail.com', description='Mocking you since 2016',