diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/build_windows_dist.bat b/build_windows_dist.bat new file mode 100644 index 0000000..ee70fd2 --- /dev/null +++ b/build_windows_dist.bat @@ -0,0 +1 @@ +python setup.py py2exe diff --git a/dataserv_client/__init__.py b/dataserv_client/__init__.py index 1e628ab..a7089da 100644 --- a/dataserv_client/__init__.py +++ b/dataserv_client/__init__.py @@ -1 +1 @@ -__version__ = "1.2.1" +__version__ = "1.3.0" diff --git a/dataserv_client/api.py b/dataserv_client/api.py index 843f29b..45bf053 100644 --- a/dataserv_client/api.py +++ b/dataserv_client/api.py @@ -61,8 +61,10 @@ def version(self): print(__version__) return __version__ - def _querry(self, api_call, retries=0): + def _url_query(self, api_call, retries=0): try: + if self.debug: + print("Query url: " + self.url + api_call) response = urllib.request.urlopen(self.url + api_call) if response.code == 200: return True @@ -84,12 +86,12 @@ def _querry(self, api_call, retries=0): if retries >= self.connection_retry_limit: raise exceptions.ConnectionError(self.url) time.sleep(self.connection_retry_delay) - return self._querry(api_call, retries + 1) + return self._url_query(api_call, retries + 1) def register(self): """Attempt to register the config address.""" self._ensure_address_given() - registered = self._querry("/api/register/{0}".format(self.address)) + registered = self._url_query("/api/register/{0}".format(self.address)) if registered: print("Address {0} now registered on {1}.".format(self.address, self.url)) @@ -99,7 +101,7 @@ def ping(self): """Attempt keep-alive with the server.""" self._ensure_address_given() print("Pinging {0} with address {1}.".format(self.url, self.address)) - return self._querry("/api/ping/{0}".format(self.address)) + return self._url_query("/api/ping/{0}".format(self.address)) def poll(self, register_address=False, delay=common.DEFAULT_DELAY, limit=None): @@ -121,11 +123,11 @@ def build(self, cleanup=False, rebuild=False): """TODO doc string""" self._ensure_address_given() def on_generate_shard(height, seed, file_hash): - self._querry('/api/height/{0}/{1}'.format(self.address, height)) + self._url_query('/api/height/{0}/{1}'.format(self.address, height)) bldr = builder.Builder(self.address, common.SHARD_SIZE, self.max_size, on_generate_shard=on_generate_shard) generated = bldr.build(self.store_path, debug=self.debug, cleanup=cleanup, rebuild=rebuild) height = len(generated) - self._querry('/api/height/{0}/{1}'.format(self.address, height)) + self._url_query('/api/height/{0}/{1}'.format(self.address, height)) return generated diff --git a/setup.py b/setup.py index 87eff88..3bf2369 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,16 @@ +#!/usr/bin/env python +# coding: utf-8 + + import os -# import sys -# from esky.bdist_esky import Executable from setuptools import setup, find_packages -VERSION = "1.2.1" # FIXME get from module +if os.name == 'nt': # windows + import py2exe # manual dependencie :/ + + +VERSION = "1.3.0" # FIXME get from module SCRIPT = os.path.join('dataserv_client', 'bin', 'dataserv-client') DOWNLOAD_URL = "%(baseurl)s/%(name)s/%(name)s-%(version)s.tar.gz" % { 'baseurl': "https://pypi.python.org/packages/source/a", @@ -13,53 +19,6 @@ } -# FIXME get autoupdate with esky working -## windows -# if sys.platform in ['win32', 'cygwin', 'win64']: -# icon = os.path.join(sys.prefix, "DLLs", "py.ico") -# script = Executable(SCRIPT, icon=icon, gui_only=False) -# options = { -# "bdist_esky": { -# "includes": [], # include modules -# "excludes": ["pydoc"], # exclude modules -# "freezer_module": "py2exe", -# #"freezer_module": "cx_Freeze", -# } -# } -# -# -## mac (untested) -# if sys.platform == 'darwin': -# script = Executable(SCRIPT) -# options = { -# "bdist_esky": { -# "includes": [], # include modules -# "excludes": ["pydoc"], # exclude modules -# "freezer_module": "py2app", -# "freezer_options": { -# "plist": { -# #"LSUIElement" : True, -# #'CFBundleIdentifier': 'de.cloudmatrix.esky', -# #'CFBundleIconFile' : 'images/box.icns', -# } -# }, -# } -# } -# -# -## linux -# if sys.platform in ['linux', 'linux2']: -# script = Executable(SCRIPT) -# options = { -# "bdist_esky": { -# "includes": [], # include modules -# "excludes": ["pydoc"], # exclude modules -# "freezer_module": "bbfreeze", # FIXME unmaintained only python 2 -# # "freezer_module": "cx_Freeze", # FIXME pip install fails -# } -# } - - setup( app=[SCRIPT], name='dataserv-client', @@ -72,12 +31,12 @@ license="MIT", version=VERSION, scripts=[SCRIPT], # FIXME esky scripts=[script], - # FIXME esky options=options, console=[SCRIPT], data_files=[], test_suite="tests", install_requires=[ 'RandomIO == 0.2.1', + 'partialhash == 1.1.0', 'future == 0.15.0', # for python 2.7 support ], tests_require=[ @@ -103,4 +62,10 @@ "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries :: Python Modules", ], + + # py2exe + options = {'py2exe': { + "optimize": 2, + "bundle_files": 2, # This tells py2exe to bundle everything + }} )