diff --git a/CHANGES.rst b/CHANGES.rst index 789d4c3c..9965b7bd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,13 +1,23 @@ Changes ======= +0.0.6 (2017-12-06) +------------------ + +* RPC speedup due to removal of extra pickling step +* Moved definition of development dependencies into ``setup.py`` +* FIX: Added workaround for `CPython issue 24960`_ (embedded zip file extracted into library folder) - was triggered by latest version of ``pluggy`` (dependency of ``pytest``) +* FIX: Preexisting installation of ``wine-python`` is now always being removed completely when required due to update or new installation + +.. _CPython issue 24960: https://bugs.python.org/issue24960 + 0.0.5 (2017-11-13) ------------------ * Added support for light-weight pointers (``ctypes.byref``) * FIX: Elements within structures are properly synchronized even if they are not a pointer on their own. * FIX: Structure objects in arrays of structures are properly initialized. -* FIX: Links in README.rst work when rendered on PyPI. +* FIX: Links in ``README.rst`` work when rendered on PyPI. 0.0.4 (2017-11-05) ------------------ diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index a5bcc98a..7e068fa6 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -57,7 +57,7 @@ Submitting patches ------------------ - Include tests if your patch is supposed to solve a bug or add a missing feature, - and explain clearly under which circumstances the bug happens what was missing. + and explain clearly under which circumstances the bug happens or what was missing. Make sure the test fails with *zugbruecke* without your patch, while it must work with *ctypes* on *Wine*. - Use **tabs** for indentation. diff --git a/HOWTORELEASE.rst b/HOWTORELEASE.rst index 910563ac..5784fccb 100644 --- a/HOWTORELEASE.rst +++ b/HOWTORELEASE.rst @@ -15,7 +15,9 @@ How to release zugbruecke #. Change to branch ``master``. -#. Merge branch ``develop`` into branch ``master`` and push it to GitHub. +#. Merge branch ``develop`` into branch ``master``. + +#. Push branch ``master`` to GitHub. #. Tag branch ``master`` with ``"v_%s" % version``. diff --git a/makefile b/makefile index 7e9445d0..e916583e 100644 --- a/makefile +++ b/makefile @@ -45,13 +45,11 @@ upload_test: done install: - pip install -r requirements.txt - pip install . + pip install --process-dependency-links .[dev] wine-pytest --version install_link: - pip install -r requirements.txt - pip install -e . + pip install --process-dependency-links -e .[dev] wine-pytest --version test: diff --git a/requirements.txt b/requirements.txt index 0d3829d4..3f0f488f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,2 @@ -setuptools -wheel -pytest -Sphinx -sphinx_rtd_theme -twine +--index-url https://pypi.python.org/simple/ +--process-dependency-links -e .[dev] diff --git a/setup.py b/setup.py index 3e0bbc3b..a560bfd2 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ # Bump version HERE! -_version_ = '0.0.5' +_version_ = '0.0.6' # List all versions of Python which are supported @@ -82,8 +82,16 @@ scripts = glob(os.path.join('scripts', '*')), include_package_data = True, install_requires = [], + extras_require = {'dev': [ + 'pytest', + 'python-language-server', + 'setuptools', + 'Sphinx', + 'sphinx_rtd_theme', + 'twine', + 'wheel' + ]}, zip_safe = False, - extras_require = {}, entry_points = {}, classifiers = [ 'Development Status :: 3 - Alpha', diff --git a/src/zugbruecke/_wrapper_.py b/src/zugbruecke/_wrapper_.py index ed6e024e..c3c45f90 100644 --- a/src/zugbruecke/_wrapper_.py +++ b/src/zugbruecke/_wrapper_.py @@ -44,7 +44,6 @@ # IMPORT: Unix ctypes members, which will be modified # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -from ctypes import cdll as ctypes_cdll_obj from ctypes import CDLL as ctypes_CDLL_class from ctypes import CFUNCTYPE as __CFUNCTYPE__ diff --git a/src/zugbruecke/core/rpc.py b/src/zugbruecke/core/rpc.py index ede8f693..23cec637 100644 --- a/src/zugbruecke/core/rpc.py +++ b/src/zugbruecke/core/rpc.py @@ -35,7 +35,6 @@ Client, Listener ) -import pickle from threading import Thread import traceback @@ -59,9 +58,9 @@ def __getattr__(self, name): def do_rpc(*args, **kwargs): # Send request to server - self.client.send(pickle.dumps((name, args, kwargs))) + self.client.send((name, args, kwargs)) # Receive answer - result = pickle.loads(self.client.recv()) + result = self.client.recv() # If the answer is an error, raise it if isinstance(result, Exception): @@ -101,14 +100,14 @@ def handle_connection(self, connection_client): while True: # Receive the incomming message - function_name, args, kwargs = pickle.loads(connection_client.recv()) + function_name, args, kwargs = connection_client.recv() # Run the RPC and send a response try: r = self.__functions__[function_name](*args,**kwargs) - connection_client.send(pickle.dumps(r)) + connection_client.send(r) except Exception as e: - connection_client.send(pickle.dumps(e)) + connection_client.send(e) except EOFError: diff --git a/src/zugbruecke/core/wineenv.py b/src/zugbruecke/core/wineenv.py index 03c472de..e582eadb 100644 --- a/src/zugbruecke/core/wineenv.py +++ b/src/zugbruecke/core/wineenv.py @@ -92,20 +92,17 @@ def setup_wine_python(arch, version, directory, overwrite = False): # Target directory target_directory = os.path.join(directory, pydir) - # Target location of python.exe - python_exe_path = os.path.join(target_directory, 'python.exe') - # Is there a pre-existing Python installation with identical parameters? - preexisting = os.path.isfile(python_exe_path) + preexisting = os.path.isfile(os.path.join(target_directory, 'python.exe')) # Is there a preexisting installation and should it be overwritten? if preexisting and overwrite: - # Delete folder - shutil.rmtree(python_exe_path) + shutil.rmtree(target_directory) # Make sure the target directory exists if not os.path.exists(directory): + # Create folder os.makedirs(directory) # Only do if Python is not there OR if should be overwritten @@ -114,7 +111,7 @@ def setup_wine_python(arch, version, directory, overwrite = False): # Generate in-memory file-like-object archive_zip = BytesIO() - # Download zip file from Python website into directory + # Download zip file from Python website into file-like-object archive_req = urllib.request.urlopen( 'https://www.python.org/ftp/python/%s/%s' % (version, pyarchive) ) @@ -123,9 +120,22 @@ def setup_wine_python(arch, version, directory, overwrite = False): # Unpack from memory to disk f = zipfile.ZipFile(archive_zip) - f.extractall(path = target_directory) + f.extractall(path = target_directory) # Directory created if required + f.close() + + # Get path of Python library zip + library_zip_path = os.path.join(target_directory, 'python%s%s.zip' % ( + version.split('.')[0], version.split('.')[1] + )) + + # Unpack Python library from embedded zip on disk + f = zipfile.ZipFile(library_zip_path, 'r') + f.extractall(path = os.path.join(target_directory, 'Lib')) # Directory created if required f.close() + # Remove Python library zip from disk + os.remove(library_zip_path) + def set_wine_env(cfg_dir, arch):