Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Improvements and Python 2.6 Support Dropped #126

Merged
merged 18 commits into from
Oct 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .ci/appveyor/lint.cmd
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
%PYTHON%\Scripts\pep8.exe C:\project\pywincffi C:\project\tests || EXIT 1
%PYTHON%\Scripts\pycodestyle.exe C:\project\pywincffi C:\project\tests || EXIT 1

SET DISABLED_PYWINCFFI_CHECKS=""
SET DISABLED_TEST_CHECKS=missing-docstring,invalid-name,too-many-arguments,protected-access,no-self-use,unused-argument,too-few-public-methods
IF "%PYTHON_VERSION%" == "2.6.x" SET DISABLED_PYWINCFFI_CHECKS=bad-option-value,unpacking-non-sequence,maybe-no-member,star-args
IF "%PYTHON_VERSION%" == "2.6.x" SET DISABLED_TEST_CHECKS=missing-docstring,invalid-name,too-many-arguments,protected-access,no-self-use,unused-argument,maybe-no-member,too-few-public-methods,too-many-public-methods,unpacking-non-sequence,bad-option-value,star-args,no-member,import-error

%PYTHON%\Scripts\pylint.exe C:\project\pywincffi --reports no --disable %DISABLED_PYWINCFFI_CHECKS% || EXIT 1
%PYTHON%\Scripts\pylint.exe C:\project\tests --reports no --disable %DISABLED_TEST_CHECKS% || EXIT 1
10 changes: 3 additions & 7 deletions .ci/appveyor/test.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
SET REQUIREMENTS=dev_requirements.txt --upgrade
IF "%PYTHON_VERSION%" == "2.6.x" SET REQUIREMENTS=dev_requirements-2.6.txt
%WITH_COMPILER% %PYTHON%\Scripts\pip.exe install -r %REQUIREMENTS% --quiet || EXIT 1

%WITH_COMPILER% %PYTHON%\Scripts\nosetests.exe --with-coverage --cover-package pywincffi -v tests || EXIT 1
%PYTHON%\Scripts\coverage.exe xml || EXIT 1
%PYTHON%\Scripts\codecov.exe --required || EXIT 1
%WITH_COMPILER% %PYTHON%\Scripts\pip.exe install -r dev_requirements.txt --upgrade --quiet || EXIT 1
%WITH_COMPILER% %PYTHON%\Scripts\py.test.exe --strict --verbose --cov pywincffi --cov-report=xml || EXIT 1
%PYTHON%\Scripts\codecov.exe -X gcov -f coverage.xml --required || EXIT 1
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
/*.egg-info/
/docs/build/
/.tox/
.coverage
/.coverage
/.coverage.*
/coverage.*
/docs/source/modules/
/.vagrant
/.provision
/.ci/vagrant/sshd/files/authorized_keys
/pywincffi.ini
/Release*
*_pywincffi.c
/.idea/
/.idea/
58 changes: 9 additions & 49 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The core objectives and design principles behind this project are:

* It should be easier to to use Windows API functions both in terms of
implementation and distribution.
* Python 2.6, 2.7 and 3.x should be supported from a single code base and
* Python 2.7 and 3.x should be supported from a single code base and
not require a consumer of pywincffi to worry about how they use the
library.
* Type conversion, error checking and other 'C like' code should be the
Expand Down Expand Up @@ -64,7 +64,7 @@ help:
Python Version Support
----------------------

This project supports Python 2.6 and up including Python 3.x. PRs, patches,
This project supports Python 2.7 and up including Python 3.x. PRs, patches,
tests etc that don't include support for both 2.x and 3.x will not be
merged. The aim is also the support both major versions of Python within
the same code base rather than rely on tools such as 2to3, six or other
Expand All @@ -87,8 +87,6 @@ It's generated directly from this library using sphinx::
The build process also builds the documentation to ensure there are not
any obvious problems (including broken links).

Note, if you're running Python 2.6 use dev_requirements-2.6.txt instead.

Function Documentation
~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -131,20 +129,6 @@ Adding new functions is covered in greater detail
Testing
-------

Nosetests
~~~~~~~~~
Tests are located in the ``tests/`` directory. The tests
themselves are run using ``nosetests`` either manually or using
the ``setup.py`` file::

virtualenv env
env/bin/activate
pip install -r dev_requirements.txt
pip install -e .
nosetests tests

Note, if you're running Python 2.6 use dev_requirements-2.6.txt instead.

Continuous Integration
~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -173,38 +157,14 @@ run ``test.bat``:

.. code-block:: console

> test.bat
========================================================================================
pep8 pywincffi
========================================================================================
========================================================================================
pep8 tests
========================================================================================
========================================================================================
pylint pywincffi
========================================================================================
========================================================================================
pylint tests
========================================================================================
========================================================================================
sphinx-build -q -b html -W -E -a -d docs/build/doctrees docs/source docs/build/html
========================================================================================
========================================================================================
sphinx-build -q -b linkcheck -W -E -a -d docs/build/doctrees docs/source docs/build/html
========================================================================================
========================================================================================
setup.py bdist_wheel
========================================================================================
RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
warn=(impl == 'cp')):
RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
warn=(impl == 'cp')):
========================================================================================
nosetests -sv tests
========================================================================================
[ omitted ]
========================================================================================
> check.bat

This will:

* Check code style for both the library and tests.
* Run all unittests.
* Build the wheel file.
* Build the documentation and treat warnings as errors.

Keep in mind that this will not setup the virtualenv or build environment for
you. So if you can't build the library or are missing a dependency then
Expand Down
16 changes: 8 additions & 8 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ environment:
WITH_COMPILER: "cmd /E:ON /V:ON /C C:\\project\\.ci\\appveyor\\run_with_compiler.cmd"

matrix:
- PYTHON: "C:\\Python26"
PYTHON_VERSION: "2.6.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python26-x64"
PYTHON_VERSION: "2.6.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"
Expand Down Expand Up @@ -45,6 +37,14 @@ environment:
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"

build: false # Not a C# project, build stuff at the test step instead.
clone_folder: C:\\project

Expand Down
28 changes: 28 additions & 0 deletions check.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@ECHO ON

:: A simple script for testing on Windows. This does almost the same thing
:: that Travis and AppVeyor do except it does not perform additional setup
:: steps such as creating a virtual environment.

pycodestyle pywincffi
IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

pycodestyle tests
IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

pylint pywincffi --reports no
IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

pylint tests --reports no ^
--disable missing-docstring,invalid-name,too-many-arguments ^
--disable protected-access,no-self-use,unused-argument ^
--disable too-few-public-methods
IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

python setup.py bdist_wheel > NUL
IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

py.test.exe --strict --verbose --cov pywincffi
IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

sphinx-build -q -b html -W -E -a -d docs/build/doctrees docs/source docs/build/html
17 changes: 0 additions & 17 deletions dev_requirements-2.6.txt

This file was deleted.

9 changes: 5 additions & 4 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
nose
pytest
pytest-cov
unittest2
pylint==1.5.2
astroid==1.4.1
pep8
pylint==1.7.4
astroid==1.5.3
pycodestyle
mock
sphinx
wheel
Expand Down
17 changes: 15 additions & 2 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ versions are shown first.
Versions
--------

latest
~~~~~~
0.5.0 (work in progress)
~~~~~~~~~~~~~~~~~~~~~~~~

Notable enhancements and changes are:

* **Python 2.6 support has been dropped**. Many projects have already moved
on from Python 2.6 including Twisted which this project was initially
intended to support. Additionally many libraries or tools that pywincffi
no longer have direct support for Python 2.6 or simply break in later
versions. This leads to having to maintain and support older libraries
in ths build which is going to become increasing difficult. Pull requests
to support Python 2.6 will be evaluated on a case-by-case basis.
* Various improvements to the tests and build including replacement of
nosetests with pytest, transition from pep8 to pycodestyle and upgrading
tools and libraries to more modern versions.

0.4.0
~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The core objectives and design principles behind this project are:

* It should be easier to to use Windows API functions both in terms of
implementation and distribution.
* Python 2.6, 2.7 and 3.x should be supported from a single code base and
* Python 2.7 and 3.x should be supported from a single code base and
not require a consumer of pywincffi to worry about how they use the
library.
* Type conversion, error checking and other 'C like' code should be the
Expand Down
1 change: 1 addition & 0 deletions pywincffi/core/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def _import_path(path, module_name=MODULE_NAME):

elif ExtensionFileLoader is not None:
loader = ExtensionFileLoader(module_name, path)
# pylint: disable=deprecated-method
return loader.load_module(module_name)

elif imp is not None: # pragma: no cover
Expand Down
4 changes: 2 additions & 2 deletions pywincffi/dev/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def download(cls, url, path=None, chunk_size=1024):

return path


Issue = namedtuple(
"Issue", ("issue", "closed", "labels", "type", "number", "url", "title"))

Expand Down Expand Up @@ -380,8 +381,7 @@ def create_release(
draft=True, prerelease=prerelease
)

else:
return message
return message


AppVeyorArtifact = namedtuple(
Expand Down
1 change: 0 additions & 1 deletion pywincffi/dev/testutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def setUpClass(cls):
# pylint: disable=broad-except
except Exception as error: # pragma: no cover
if os.name == "nt":
# pylint: disable=redefined-variable-type
SharedState.ffi = error

cls.HAS_INTERNET = SharedState.HAS_INTERNET
Expand Down
7 changes: 4 additions & 3 deletions pywincffi/wintypes/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ def wintype_to_cdata(wintype):
ffi, _ = dist.load()
if wintype is None:
return ffi.NULL
elif isinstance(wintype, (SOCKET, HANDLE, WSAEVENT)):

if isinstance(wintype, (SOCKET, HANDLE, WSAEVENT)):
return wintype._cdata[0]
else:
return wintype._cdata

return wintype._cdata


def handle_from_file(file_):
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def run(self):
filename = join(root, filename)
self.upload_file(command, pyversion, filename)


setup_keywords = dict(
name="pywincffi",
version=".".join(map(str, __version__)),
Expand All @@ -101,15 +102,14 @@ def run(self):
long_description=long_description,
setup_requires=requirements,
install_requires=requirements,
test_suite="nose.collector",
classifiers=[
"Development Status :: 3 - Alpha",
"Development Status :: 5 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Environment :: Win32 (MS Windows)",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
Expand Down
52 changes: 0 additions & 52 deletions test.bat

This file was deleted.

1 change: 1 addition & 0 deletions tests/test_dev/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ def test_commit(self):
# pylint: disable=no-member
api.repo.get_branch.assert_called_with(api.branch)


FakeLabel = namedtuple("FakeLabel", ("name", ))


Expand Down
Loading