Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fireteam/curlish
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Sep 25, 2013
2 parents ffcb29a + c640bf2 commit 2f5d75e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,2 +1,5 @@
docs/_build
.DS_Store
build
dist
curl.exe
12 changes: 10 additions & 2 deletions curlish.py
Expand Up @@ -68,6 +68,10 @@
from uuid import UUID


# Not set when frozen
globals().setdefault('__file__', 'curlish.py')


def str_to_uuid(s):
try:
UUID(s)
Expand Down Expand Up @@ -473,14 +477,18 @@ def get_site(site_name, url_arg):
def get_default_curl_path():
"""Tries to find curl and returns the path to it."""
def tryrun(path):
subprocess.call([path, '--version'], stdout=subprocess.PIPE,
stdin=subprocess.PIPE)
try:
subprocess.call([path, '--version'], stdout=subprocess.PIPE,
stdin=subprocess.PIPE)
except OSError:
return False
return True
if tryrun('curl'):
return 'curl'
base = os.path.abspath(os.path.dirname(__file__))
for name in 'curl', 'curl.exe':
fullpath = os.path.join(base, name)
print fullpath
if tryrun(fullpath):
return fullpath

Expand Down
14 changes: 14 additions & 0 deletions setup_freeze.py
@@ -0,0 +1,14 @@
import os
from cx_Freeze import setup, Executable


build_exe_options = {
'include_files': ['curl.exe']
}


setup(name="curlish",
version="1.0",
description="Curlish",
options={"build_exe": build_exe_options},
executables=[Executable("curlish.py")])

0 comments on commit 2f5d75e

Please sign in to comment.