Skip to content

Commit

Permalink
Release of 0.0.3 (cleanups, 1D fixed length arrays)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-m-e committed Nov 2, 2017
2 parents 6a36978 + 4f4b72e commit 37c1ee5
Show file tree
Hide file tree
Showing 33 changed files with 327 additions and 338 deletions.
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changes
=======

0.0.3 (2017-11-02)
------------------

* Implemented fixed length 1D arrays
* Refactored argument packing and unpacking code
* Plenty of cleanups based on static code analysis
* Introduced ``Python``'s ``any`` functions in a number of places
* Fixed lots of typos and grammar issues in documentation

0.0.2 (2017-07-28)
------------------

Expand Down
20 changes: 10 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ allowing you to cleanly integrate Windows applications into your desktop.*
Prerequisites
=============

+--------------------+--------------------------------------------------------------------------------------------------------+
| for usage + - `CPython`_ 3.x (tested with 3.{4,5,6}) - no additional Python packages required +
| + - `Wine`_ 2.x (tested with 2.{5,6,10,12} regular & `staging`_) - expected to be in the user's `PATH`_ +
+--------------------+--------------------------------------------------------------------------------------------------------+
| for tests + - `pytest`_ +
| + - `mingw cross-compiler`_ - for building DLLs against which examples and tests can be run +
+--------------------+--------------------------------------------------------------------------------------------------------+
| for documentation + - `Sphinx`_ +
+--------------------+--------------------------------------------------------------------------------------------------------+
+--------------------+-------------------------------------------------------------------------------------------------------------+
| for usage + - `CPython`_ 3.x (tested with 3.{4,5,6}) - no additional Python packages required +
| + - `Wine`_ 2.x (tested with 2.{5,6,10,12,18,19} regular & `staging`_) - expected to be in the user's `PATH`_ +
+--------------------+-------------------------------------------------------------------------------------------------------------+
| for tests + - `pytest`_ +
| + - `mingw cross-compiler`_ - for building DLLs against which examples and tests can be run +
+--------------------+-------------------------------------------------------------------------------------------------------------+
| for documentation + - `Sphinx`_ +
+--------------------+-------------------------------------------------------------------------------------------------------------+

.. _CPython: https://www.python.org/
.. _Wine: https://www.winehq.org/
Expand Down Expand Up @@ -118,7 +118,7 @@ Start an interactive Python session under Unix and try the following:
You have just witnessed ``msvcrt.dll`` in action on Unix. Interested in more?
Check the `examples`_ in zugbruecke's documentation or read `ctypes' documentation`_.

A lot of code, which was written with ``cdll``, ``windll`` or ``oledll``
A lot of code, which was written with ``ctypes``' ``cdll``, ``windll`` or ``oledll``
in mind and which runs under Windows, should run just fine with zugbruecke
on Unix (assuming it does not use Windows features not supported by Wine).

Expand Down
12 changes: 6 additions & 6 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Configuring the session constructor
-----------------------------------

If you chose to start your own session with ``zugbruecke.session()``, the session
constructor can be provided with a dictionaries containing parameters.
constructor can be provided with a dictionary containing parameters.

Configuration files
-------------------
Expand All @@ -44,7 +44,7 @@ Parameters passed directly into the *zugbuecke* session constructor will
always be given priority. Beyond that, missing parameters are being looked for
location after location in the above listed places. If, after checking for
configuration files in all those locations, there are still parameters
left unconfigured, *zugbuecke* will fill them with its defaults. A parameter
left undefined, *zugbuecke* will fill them with its defaults. A parameter
found in a location higher in the list will always be given priority over
a the same parameter with different content found in a location further down the list.

Expand Down Expand Up @@ -73,13 +73,13 @@ necessary.
``stdout`` (bool)
^^^^^^^^^^^^^^^^^

Tells *zugbuecke* to show messages its sub-processes write to ``stdout``.
Tells *zugbuecke* to show messages its sub-processes are writing to ``stdout``.
``True`` by default.

``stderr`` (bool)
^^^^^^^^^^^^^^^^^

Tells *zugbuecke* to show messages its sub-processes write to ``stderr``.
Tells *zugbuecke* to show messages its sub-processes are writing to ``stderr``.
``True`` by default.

``logwrite`` (bool)
Expand All @@ -106,14 +106,14 @@ Default is ``win32``, even on 64-bit systems. It appears to be a more stable con
The ``version`` parameter tells *zugbuecke* what version of the *Windows* *CPython* interpreter
it should use. By default, it is set to ``3.5.3``.

Please not that 3.4 and earlier are not supported. In the opposite direction, at the time of
Please note that 3.4 and earlier are not supported. In the opposite direction, at the time of
writing, 3.6 (and later) does not work under *Wine* due to a `bug in Wine`_.

.. _bug in Wine: https://github.com/pleiszenburg/zugbruecke/issues/13

``dir`` (str)
^^^^^^^^^^^^^

This parameter defines the root directory of *zugbruecke*. It is where *zugbruecke*'s
This parameter defines the root directory of *zugbruecke*. This is where *zugbruecke*'s
own *Wine* profile folder is stored (``WINEPREFIX``) and where the :ref:`Wine Python environment <wineenv>`
resides. By default, it is set to ``~/.zugbruecke``.
6 changes: 3 additions & 3 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ looks somewhat like this:
float __stdcall __declspec(dllimport) simple_demo_routine(float param_a, float param_b)
{ return param_a - (param_a / param_b); }
Because of the drop-in replacement design of zugbruecke, it is possible to write
Python code which works under both Unices and Windows.
Because of the drop-in replacement design of *zugbruecke*, it is possible to write
*Python* code which works under both *Unices* and *Windows*.

.. code:: python
from sys import platform
if True in [platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]:
if any([platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]):
from zugbruecke import cdll
elif platform.startswith('win'):
from ctypes import cdll
Expand Down
4 changes: 2 additions & 2 deletions docs/interoperability.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Return value
* ``path_out`` (str)

Converts an absolute or relative *Unix* path into a *Windows* path. It does
not check, whether the path actually exists ot not. It uses *Wine*'s internal
not check, whether the path actually exists or not. It uses *Wine*'s internal
implementation for path conversion.

Method: ``path_wine_to_unix``
Expand All @@ -46,5 +46,5 @@ Return value
* ``path_out`` (str)

Converts an absolute or relative *Windows* path into a *Unix* path. It does
not check, whether the path actually exists ot not. It uses *Wine*'s internal
not check, whether the path actually exists or not. It uses *Wine*'s internal
implementation for path conversion.
2 changes: 1 addition & 1 deletion docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Implementation
During the first import of *zugbruecke*, a stand-alone *Windows*-version of the
*CPython* interpreter corresponding to the used *Unix*-version is automatically
downloaded and placed into the module's configuration folder (by default located at
``~/.zugbruecke/``). Next to it, also during first import, zugbruecke
``~/.zugbruecke/``). Next to it, also during first import, *zugbruecke*
generates its own *Wine*-profile directory for being used with a dedicated
``WINEPREFIX``. This way, any undesirable interferences with other *Wine*-profile
directories containing user settings and unrelated software are avoided.
Expand Down
6 changes: 3 additions & 3 deletions docs/memsync.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The memory synchronization protocol
Because *zugbruecke* runs code in a separate *Python* interpreter on *Wine*,
pointers pose a special kind of problem. They can, unfortunately, not be passed
from the code running on the *Unix* side to the code running on the *Wine* side
or vice versa. This is why the memory pointers are pointing to must be kept in
or vice versa. This is why the memory (to where pointers are pointing) must be kept in
sync on both sides. The memory synchronization can be controlled by the user
through the ``memsync`` protocol. ``memsync`` implements special directives,
which do not interfere with *ctypes* should the code be required to run on
Expand Down Expand Up @@ -48,7 +48,7 @@ Consider the following example DLL routine in C:
}
}
It is a really simple implementation of the "bubblesort" algorithm, which accepts
It is a simple implementation of the "bubblesort" algorithm, which accepts
a pointer to an array of floats of arbitrary length and an integer with length information.
The array is being sorted within its own memory, so the caller expects a sorted
array at the passed pointer after the call.
Expand Down Expand Up @@ -120,7 +120,7 @@ The complete example, which will run on *Unix* and on *Windows* looks just like
.. code:: python
from sys import platform
if True in [platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]:
if any([platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]):
from zugbruecke import windll, cast, pointer, POINTER, c_float, c_int
elif platform.startswith('win'):
from ctypes import windll, cast, pointer, POINTER, c_float, c_int
Expand Down
2 changes: 1 addition & 1 deletion docs/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ The following problems also directly apply to *zugbruecke*:
.. _Windows malware: https://en.wikipedia.org/wiki/Wine_(software)#Security
.. _FAQ at WineHQ: https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F

*zugbruecke* does not actively prohibit the its use with root privileges.
*zugbruecke* does not actively prohibit its use with root privileges.
2 changes: 1 addition & 1 deletion docs/session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ All limitations and features of those constructors apply, e.g. the possibility
of referring to DLLs without their .dll-file-extension or the use of absolute
or relative *Windows* paths. *zugbruecke* offers :ref:`methods for path conversion <interoperability>`
if required. If *ctypes* on the *Wine* side raises an error, e.g. because the DLL
could not be found, the error will be re-raised by *zugbruecke* on the Unix side.
can not be found, the error will be re-raised by *zugbruecke* on the Unix side.

The third parameter is optional and allows to pass a dict with the following keys:

Expand Down
2 changes: 1 addition & 1 deletion docs/wineenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Command: ``wine-python``

This command behaves just like the regular ``python`` command in a *Unix* shell,
except that it fires up a *Windows* *Python* interpreter on top of *Wine*. It works
will all regular parameters and switches, even excepts pipes and can be launched in
with all regular parameters and switches, accepts pipes and can be launched in
interactive mode.

You can also use it for creating executable *Python* scripts by adding the following
Expand Down
8 changes: 4 additions & 4 deletions examples/test_cookbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
# IMPORT
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

import sys
import os
import time
# import sys
# import os
# import time
from sys import argv, platform
import timeit

Expand All @@ -46,7 +46,7 @@
except:
pass

if True in [platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]:
if any([platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]):

f = open('.zugbruecke.json', 'w')
if TIMING_RUN:
Expand Down
10 changes: 5 additions & 5 deletions examples/test_zugbruecke.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
# IMPORT
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

import sys
import os
import time
# import sys
# import os
# import time
from sys import platform

if True in [platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]:
if any([platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]):

f = open('.zugbruecke.json', 'w')
f.write('{"log_level": 10}')
f.close()

import zugbruecke
ctypes = zugbruecke

Expand Down
8 changes: 4 additions & 4 deletions examples/test_zugbruecke_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
# IMPORT
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

import sys
import os
import time
# import sys
# import os
# import time
import timeit
from sys import platform

if True in [platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]:
if any([platform.startswith(os_name) for os_name in ['linux', 'darwin', 'freebsd']]):

f = open('.zugbruecke.json', 'w')
f.write('{}')
Expand Down
6 changes: 6 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ test:
wine-pytest
-rm tests/__pycache__/*.pyc
pytest

test_quick:
-rm tests/__pycache__/*.pyc
wine-pytest
-rm tests/__pycache__/*.pyc
pytest
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@


# Bump version HERE!
_version_ = '0.0.2'
_version_ = '0.0.3'


# List all versions of Python which are supported
Expand Down
Loading

0 comments on commit 37c1ee5

Please sign in to comment.