diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-09-05 00:38:03 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-09-05 00:38:03 +0200 |
commit | fdd9a650f30cb4ae6acb076def47b796d386fbd3 (patch) | |
tree | e0300090245605716ff0e3f5a415d396c5a0134b | |
parent | a496e4adefed01097fd021949857e955aa9654cb (diff) | |
download | psutil-fdd9a650f30cb4ae6acb076def47b796d386fbd3.tar.gz |
refactor make files
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | scripts/internal/winmake.py | 45 |
2 files changed, 27 insertions, 24 deletions
@@ -56,16 +56,16 @@ clean: # Compile without installing. build: clean $(PYTHON) setup.py build - @# copies *.so files in ./psutil directory in order to allow + @# copies compiled *.so files in ./psutil directory in order to allow @# "import psutil" when using the interactive interpreter from within @# this directory. $(PYTHON) setup.py build_ext -i rm -rf tmp -# Install this package. Install is done: +# Install this package + GIT hooks. Install is done: # - as the current user, in order to avoid permission issues # - in development / edit mode, so that source can be modified on the fly -install: build +install: install_git_hooks build $(PYTHON) setup.py develop $(INSTALL_OPTS) rm -rf tmp diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py index bb0a37f0..23ccbca2 100644 --- a/scripts/internal/winmake.py +++ b/scripts/internal/winmake.py @@ -19,6 +19,7 @@ import shutil import ssl import subprocess import sys +import tempfile import textwrap @@ -113,31 +114,29 @@ def rm(pattern, directory=False): def install_pip(): try: import pip # NOQA - return except ImportError: - pass - - if PY3: - from urllib.request import urlopen - else: - from urllib2 import urlopen + if PY3: + from urllib.request import urlopen + else: + from urllib2 import urlopen - if hasattr(ssl, '_create_unverified_context'): - ctx = ssl._create_unverified_context() - else: - ctx = None - kw = dict(context=ctx) if ctx else {} - print("downloading %s" % GET_PIP_URL) - req = urlopen(GET_PIP_URL, **kw) - data = req.read() + if hasattr(ssl, '_create_unverified_context'): + ctx = ssl._create_unverified_context() + else: + ctx = None + kw = dict(context=ctx) if ctx else {} + print("downloading %s" % GET_PIP_URL) + req = urlopen(GET_PIP_URL, **kw) + data = req.read() - with open('get-pip.py', 'wb') as f: - f.write(data) + tfile = os.path.join(tempfile.gettempdir(), 'get-pip.py') + with open(tfile, 'wb') as f: + f.write(data) - try: - sh('%s %s --user' % (PYTHON, f.name)) - finally: - os.remove(f.name) + try: + sh('%s %s --user' % (PYTHON, tfile)) + finally: + os.remove(tfile) # =================================================================== @@ -157,12 +156,16 @@ def help(): def build(): """Build / compile""" sh("%s setup.py build" % PYTHON) + # copies compiled *.pyd files in ./psutil directory in order to + # allow "import psutil" when using the interactive interpreter + # from within this directory. sh("%s setup.py build_ext -i" % PYTHON) @cmd def install(): """Install in develop / edit mode""" + install_git_hooks() build() sh("%s setup.py develop" % PYTHON) |