Skip to content

Commit

Permalink
some cleanup and hilarious version hack
Browse files Browse the repository at this point in the history
  • Loading branch information
swistakm committed Jan 25, 2016
1 parent 272aab4 commit a6d4d94
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
21 changes: 16 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit a6d4d94

Please sign in to comment.