Skip to content

Commit

Permalink
fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkowl committed Aug 17, 2016
2 parents 7a58018 + dc7488c commit b381c26
Show file tree
Hide file tree
Showing 160 changed files with 4,472 additions and 2,321 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ source = twisted
source=
twisted
build/*/lib/python*/site-packages/twisted
build/*/Lib/site-packages/twisted
build/pypy*/site-packages/twisted

[report]
Expand Down
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ matrix:
# on starting separate jobs.
- python: 2.7
env: TOXENV=narrativedocs,apidocs,pyflakes,topfile,manifest-checker
- python: 3.5
env: TOXENV=pyflakes3
# Twistedchecker is running as a separate job so that we can ignore if it
# fails.
- python: 2.7
env: TOXENV=txchecker-travis
#
# OSX 10.10
#
Expand All @@ -44,6 +50,9 @@ matrix:
allow_failures:
# For now, OSX run on Travis-CI has a few failures.
- os: osx
# twistedchecker job was introduce as an experimental job.
# Once it is stable we can enforce it
- env: TOXENV=txchecker-travis


addons:
Expand Down
46 changes: 46 additions & 0 deletions .travis/twistedchecker-trunk-diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env sh
#
# Helper for running twistedchecker and reporting only errors that are part
# of the changes since trunk.
#
# Call it as:
# * SCRIPT_NAME twisted
# * SCRIPT_NAME twisted/words/
# * SCRIPT_NAME twisted.words

target=$1

# FIXME: https://github.com/twisted/twistedchecker/issues/116
# Since for unknown modules twistedchecker will return the same error, the
# diff will fail to detect that we are trying to check an invalid path or
# module.
# This is why we check that the argument is a path and if not a path, it is
# an importable module.
if [ ! -d "$target" ]; then
python -c "import $target" 2> /dev/null
if [ $? -ne 0 ]; then
>&2 echo "$target does not exists as a path or as a module."
exit 1
fi
fi

# Make sure we have trunk on the local repo.
git fetch origin trunk:refs/remotes/origin/trunk

mkdir -p build/
twistedchecker -f parseable $target > build/twistedchecker-branch.report

echo 'NOTICE: TypeError: compile() traceback are a known'
echo 'See: https://github.com/twisted/twistedchecker/issues/118'

# Make sure repo is producing the diff with prefix so that the output of
# `git diff` can be parsed by diff_cover.
git config diff.noprefix false

diff-quality \
--violations=pylint \
--fail-under=100 \
--compare-branch=origin/trunk build/twistedchecker-branch.report

diff_exit_code=$?
exit $diff_exit_code
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Timothy Allen
Tom Prince
Travis B. Hartwell

and others that have contributed code to the public domain.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
Expand Down
8 changes: 5 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ include tox.ini .coveragerc
# Include our docs templates
recursive-include src/twisted/python/_pydoctortemplates *.html

# Python 3 setup file
include setup3.py

# Some tests stuff
recursive-include src/twisted *.pem
include src/twisted/internet/test/fake_CAs/*
include src/twisted/mail/test/rfc822.message

# Some extras
<<<<<<< HEAD
recursive-include src/twisted *.glade *.pxi *.h *.c *.bat *.g *.pyx *.zsh *.txt
=======
recursive-include twisted *.3only
recursive-include twisted *.glade *.pxi *.h *.c *.bat *.g *.pyx *.zsh *.txt
>>>>>>> origin/trunk

# Docs
include docs/fun/lightbulb
Expand Down
57 changes: 47 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,70 @@ cache:

environment:
global:
TRIAL_REPORTER: text
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\bin\\admin\\run_with_env.cmd"

# Only use pre-installed Python versions, which Appveyor may upgrade to
# a later point release.
# See: http://www.appveyor.com/docs/installed-software#python
matrix:
- PYTHON: C:\Python27-x64
- PYTHON_HOME: C:\\Python27-x64
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
TOXENV: py27-coverage-windows,codecov-publish
- PYTHON_HOME: C:\\PYTHON35-x64
PYTHON_VERSION: "3.5"
PYTHON_ARCH: "64"
TOXENV: py35-coverage-windows,codecov-publish
# The --reactor flag to trial doesn't work on Windows Python 3
# so we can only choose the default reactor here:
# https://twistedmatrix.com/trac/ticket/8745
TWISTED_REACTOR: "default"

matrix:
allow_failures:
# Some tests are still failing on Python 3.
# These tests will be fixed in separate tickets.
- PYTHON_VERSION: "3.5"

install:
# Install OpenSSH through chocolatey
- "choco install win32-openssh -confirm"
- cmd: "SET PATH=%PATH%;C:\\Program Files\\OpenSSH-Win64"

# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;%PATH%"
- "SET LIB=%PYTHON_HOME%\\lib;%LIB%"

# The following line is inspired by http://nedbatchelder.com/blog/201509/appveyor.html
# Tox has an internal mapping of where to find python.exe. Unfortunately,
# this internal mapping is not the same as the Appveyor build host, which has
# to install separate python.exe in different directories for 32-bit and 64-bit.
# We write out a .bat file which invokes the correct python.exe. tox will invoke
# this .at file. This issue becomes important because linking to python.lib
# will fail without this.
- "python -c \"import os; open('python{0}.bat'.format(os.environ['PYTHON_VERSION']), 'w').write('@{0}\\\\python \\x25*\\n'.format(os.environ['PYTHON_HOME']))\""
- "type python*.bat"

# Get some information about the build environment.
# Uncomment them. Left here so that you don't have to search the net for
# how to run such command on Windows :)
# - ps: "ls \"C:/\""
# - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
# - ps: echo $env:PYTHON $env:TOXENV
# Check that we have the expected version and architecture for Python
- "%PYTHON%\\python --version"
- "%PYTHON%\\python -c \"import struct; print(struct.calcsize('P') * 8)\""
- "python -c \"import sys; print(sys.prefix)\""
- "python -c \"import sys; print(sys.exec_prefix)\""
- "python -c \"import sys; print(sys.executable)\""
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""

# The build system itself is handled by tox.
- "%PYTHON%\\Scripts\\pip install tox"

# Install OpenSSH through chocolatey
- "choco install win32-openssh -confirm"
- cmd: "SET PATH=%PATH%;C:\\Program Files\\OpenSSH-Win64"
- "python -m pip install tox"

test_script:
- "%PYTHON%\\python -m tox -e %TOXENV%"
- "%CMD_IN_ENV% python -m tox -e %TOXENV%"
88 changes: 88 additions & 0 deletions bin/admin/run_with_env.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
:: To build extensions for 64 bit Python 3, we need to configure environment
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
::
:: To build extensions for 64 bit Python 2, we need to configure environment
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
::
:: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific
:: environment configurations.
::
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
:: cmd interpreter, at least for (SDK v7.0)
::
:: More details at:
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
:: http://stackoverflow.com/a/13751649/163740
::
:: Author: Olivier Grisel
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
::
:: Notes about batch files for Python people:
::
:: Quotes in values are literally part of the values:
:: SET FOO="bar"
:: FOO is now five characters long: " b a r "
:: If you don't want quotes, don't include them on the right-hand side.
::
:: The CALL lines at the end of this file look redundant, but if you move them
:: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y
:: case, I don't know why.
@ECHO OFF

SET COMMAND_TO_RUN=%*
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf

:: Extract the major and minor versions, and allow for the minor version to be
:: more than 9. This requires the version number to have two dots in it.
SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1%
IF "%PYTHON_VERSION:~3,1%" == "." (
SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1%
) ELSE (
SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,2%
)

:: Based on the Python version, determine what SDK version to use, and whether
:: to set the SDK for 64-bit.
IF %MAJOR_PYTHON_VERSION% == 2 (
SET WINDOWS_SDK_VERSION="v7.0"
SET SET_SDK_64=Y
) ELSE (
IF %MAJOR_PYTHON_VERSION% == 3 (
SET WINDOWS_SDK_VERSION="v7.1"
IF %MINOR_PYTHON_VERSION% LEQ 4 (
SET SET_SDK_64=Y
) ELSE (
SET SET_SDK_64=N
IF EXIST "%WIN_WDK%" (
:: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/
REN "%WIN_WDK%" 0wdf
)
)
) ELSE (
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
EXIT 1
)
)

IF %PYTHON_ARCH% == 64 (
IF %SET_SDK_64% == Y (
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
SET DISTUTILS_USE_SDK=1
SET MSSdk=1
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
) ELSE (
ECHO Using default MSVC build environment for 64 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
)
) ELSE (
ECHO Using default MSVC build environment for 32 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
)
25 changes: 12 additions & 13 deletions docs/core/howto/constants.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

:LastChangedDate: $LastChangedDate$
:LastChangedRevision: $LastChangedRevision$
:LastChangedBy: $LastChangedBy$


Symbolic Constants
==================

.. note::

``twisted.python.constants`` has been deprecated in Twisted, and the same code has been spun out into `Constantly <http://constantly.readthedocs.org/en/latest/>`_\.
The API is identical, just install it from PyPI and replace ``import twisted.python.constants`` with ``import constantly`` in your code.


Overview
--------
Expand Down Expand Up @@ -95,14 +94,14 @@ The order is defined to be the same as the instantiation order of the constants:
... a = NamedConstant()
... b = NamedConstant()
... c = NamedConstant()
...
...
>>> Letters.a < Letters.b < Letters.c
True
>>> Letters.a > Letters.b
>>> Letters.a > Letters.b
False
>>> sorted([Letters.b, Letters.a, Letters.c])
[<Letters=a>, <Letters=b>, <Letters=c>]
>>>
>>>
A subclass of ``Names`` may define class methods to implement custom functionality.
Consider this definition of ``METHOD`` :
Expand All @@ -118,7 +117,7 @@ Consider this definition of ``METHOD`` :
PUT = NamedConstant()
POST = NamedConstant()
DELETE = NamedConstant()
@classmethod
def isIdempotent(cls, method):
"""
Expand Down Expand Up @@ -238,7 +237,7 @@ As with ``Names`` , a subclass of ``Values`` can define custom methods:
NO_CONTENT = ValueConstant("204")
NOT_MODIFIED = ValueConstant("304")
NOT_FOUND = ValueConstant("404")
@classmethod
def hasBody(cls, status):
"""
Expand All @@ -260,7 +259,7 @@ This functionality can be used as any class methods are used:
Constants As Flags
------------------

Integers are often used as a simple set for constants.
The values for these constants are assigned as powers of two so that bits in the integer can be set to represent them.
Individual bits are often called *flags* .
Expand Down Expand Up @@ -384,7 +383,7 @@ Consider this addition to that class:
from twisted.python.constants import FlagConstant, Flags
class Permission(Flags):
...
@classmethod
def format(cls, permissions):
"""
Expand Down
Loading

0 comments on commit b381c26

Please sign in to comment.