8000 Merge branch 'develop' · pythonnet/pythonnet@eb70436 · GitHub
[go: up one dir, main page]

Skip to content

Commit eb70436

Browse files
committed
Merge branch 'develop'
2 parents 4e2a3bd + d818b6e commit eb70436

File tree

227 files changed

+23059
-17328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+23059
-17328
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*.suo
2+
*.pdb
3+
[Oo]bj/
4+
[Bb]in/
5+
*.dll
6+
*.pyd
7+
*.exe
8+
*.pyc
9+
packages/*
10+
dist
11+
pythonnet.egg-info
12+
*.userprefs

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: python
2+
python:
3+
- 2.6
4+
- 2.7
5+
before_install:
6+
- sudo apt-get install software-properties-common
7+
- sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"
8+
- sudo apt-get -qq update
9+
- sudo apt-get -qq install mono-devel mono-gmcs mono-xbuild nunit-console
10+
- sudo mozroots --import --machine --sync
11+
- yes | sudo certmgr -ssl -m https://go.microsoft.com
12+
- yes | sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net
13+
- yes | sudo certmgr -ssl -m https://nuget.org
14+
install:
15+
- python setup.py build_ext --inplace
16+
script:
17+
- export PYTHONPATH=`pwd`
18+
- ./npython src/tests/runtests.py
File renamed without changes.

Python.Runtime.dll.config

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- Mono DLL map for Python.Runtime.dll
2+
3+
Keep this file next to Python.Runtime.dll
4+
5+
For more information read:
6+
http://www.mono-project.com/Config
7+
http://www.mono-project.com/Config_DllMap
8+
9+
-->
10+
11+
<configuration>
12+
<dllmap dll="python23" target="libpython2.3.so" os="!windows" />
13+
<dllmap dll="python24" target="libpython2.4.so" os="!windows" />
14+
<dllmap dll="python25" target="libpython2.5.so" os="!windows" />
15+
<dllmap dll="python26" target="libpython2.6.so" os="!windows" />
16+
<dllmap dll="python27" target="libpython2.7.so" os="!windows" />
17+
<dllmap dll="python23.dll" target="libpython2.3.so" os="!windows" />
18+
<dllmap dll="python24.dll" target="libpython2.4.so" os="!windows" />
19+
<dllmap dll="python25.dll" target="libpython2.5.so" os="!windows" />
20+
<dllmap dll="python26.dll" target="libpython2.6.so" os="!windows" />
21+
<dllmap dll="python27.dll" target="libpython2.7.so" os="!windows" />
22+
</configuration>
23+

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pythonnet
2+
=========
3+
4+
Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET developers.
5+
6+
[![Build Status](https://travis-ci.org/pythonnet/pythonnet.png?branch=develop)](https://travis-ci.org/pythonnet/pythonnet)
7+
8+
[![Build status](https://ci.appveyor.com/api/projects/status/65riiu1hvgaxsbwb)](https://ci.appveyor.com/project/da 48DA vidanthoff/pythonnet)

VS_README.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Visual Studio 2005
2+
==================
3+
4+
pythonnet contains a new solution file for Visual Studio 2005: pythonnet.sln
5+
It should make development under Windows much easier since you don't have to
6+
install MSys or Cygwin to run the makefile.
7+
8+
The solution file should work with the free VS .NET Express Edition.
9+
10+
Available configurations
11+
------------------------
12+
13+
Every configuration copies the dll, pdf and exe files to the root directory
14+
of the project.
15+
16+
* Release
17+
Builds Python.Runtime, Python.Tests, clr.pyd and python.exe. The console
18+
project starts a Python console
19+
20+
* Debug
21+
Same as Release but creates a build with debug symbols
22+
23+
* UnitTest
24+
Builds a Debug build. The console project invokes runtests.py instead of
25+
opening a Python shell.
26+
27+
* EmbeddingTest
28+
Builds Python.EmbeddingTests and its dependencies. The configuration
29+
requires the NUunit framework.
30+
31+
Python version
32+
--------------
33+
34+
You can switch the destination version by defining either PYTHON24 or PYTHON25
35+
inside the Python.Runtime project.
36+
37+
** Don't forget to force a rebuild after you have altered the setting! **
38+
39+
MS VS doesn't take changes to define into account.
40+
41+
Thanks to Virgil Duprasfor his original VS howto!
42+
43+
Christian 'Tiran' Heimes

appveyor.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
os: Windows Server 2012
2+
3+
environment:
4+
global:
5+
PYTHONPATH: c:\testdir
6+
7+
matrix:
8+
- pythonurl: http://www.python.org/ftp/python/2.7.6/python-2.7.6.amd64.msi
9+
- pythonurl: http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi
10+
- pythonurl: http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi
11+
- pythonurl: http://www.python.org/ftp/python/2.6.6/python-2.6.6.amd64.msi
12+
13+
install:
14+
- ps: (new-object net.webclient).DownloadFile($env:pythonurl, 'C:\python.msi')
15+
- ps: start-process -wait -FilePath msiexec.exe -ArgumentList "/qn /i C:\python.msi TARGETDIR=C:\Python"
16+
- ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:\get-pip.py')
17+
# appveyor has python 2.7.6 x86 preinstalled, but in the wrong directory, this works around this
18+
- ps: if ($env:pythonurl -eq "http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi") {mi c:\python27 c:\python}
19+
- set PATH=C:\Python;%PATH%
20+
- C:\Python\python.exe c:\get-pip.py
21+
- C:\Python\Scripts\pip.exe install wheel
22+
23+
build_script:
24+
- C:\python\python.exe setup.py bdist_wheel
25+
26+
test_script:
27+
- ps: C:\python\scripts\pip.exe install ("dist\" + (gci dist)[0].Name)
28+
- mkdir c:\testdir
29+
- ps: copy-item (gci -path build -re -include Python.Test.dll)[0].FullName c:\testdir
30+
- c:\python\python.exe src\tests\runtests.py
31+
- c:\python\scripts\npython.exe src\tests\runtests.py

pythonnet/demo/helloform.py renamed to demo/helloform.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
# FOR A PARTICULAR PURPOSE.
88
# ===========================================================================
99

10+
import clr
11+
SWF = clr.AddReference("System.Windows.Forms")
12+
print SWF.Location
1013
import System.Windows.Forms as WinForms
1114
from System.Drawing import Size, Point
1215

@@ -24,8 +27,8 @@ def __init__(self):
2427

2528
# Create the button
2629
self.button = WinForms.Button()
27-
self.button.Location = Point(256, 64)
28-
self.button.Size = Size(120, 10000 40)
30+
self.button.Location = Point(160, 64)
31+
self.button.Size = Size(820, 20)
2932
self.button.TabIndex = 2
3033
self.button.Text = "Click Me!"
3134

@@ -36,8 +39,8 @@ def __init__(self):
3639
self.textbox = WinForms.TextBox()
3740
self.textbox.Text = "Hello World"
3841
self.textbox.TabIndex = 1
39-
self.textbox.Size = Size(360, 20)
40-
self.textbox.Location = Point(16, 24)
42+
self.textbox.Size = Size(1260, 40)
43+
self.textbox.Location = Point(160, 24)
4144

4245
# Add the controls to the form
4346
self.AcceptButton = self.button
@@ -46,14 +49,19 @@ def __init__(self):
4649

4750
def button_Click(self, sender, args):
4851
"""Button click event handler"""
52+
print "Click"
4953
WinForms.MessageBox.Show("Please do not press this button again.")
5054

5155
def run(self):
5256
WinForms.Application.Run(self)
5357

5458

5559
def main():
56-
HelloApp().run()
60+
form = HelloApp()
61+
print "form created"
62+
app = WinForms.Application
63+
print "app referenced"
64+
app.Run(form)
5765

5866

5967
if __name__ == '__main__':
File renamed without changes.
File renamed without changes.

doc/Python.Runtime.dll.config

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!-- Mono DLL map for Python.Runtime.dll
2+
3+
Keep this file next to Python.Runtime.dll
4+
5+
For more information read:
6+
http://www.mono-project.com/Config
7+
http://www.mono-project.com/Config_DllMap
8+
9+
-->
10+
11+
<configuration>
12+
<dllmap dll="python23" target="/usr/lib/libpython2.3.dylib" os="!windows" />
13+
<dllmap dll="python24" target="/usr/lib/libpython2.4.dylib" os="!windows" />
14+
<dllmap dll="python25" target="/usr/lib/libpython2.5.dylib" os="!windows" />
15+
<dllmap dll="python26" target="/usr/lib/libpython2.6.dylib" os="!windows" />
16+
<dllmap dll="python23.dll" target="/usr/lib/libpython2.3.dylib" os="!windows" />
17+
<dllmap dll="python24.dll" target="/usr/lib/libpython2.4.dylib" os="!windows" />
18+
<dllmap dll="python25.dll" target="/usr/lib/libpython2.5.dylib" os="!windows" />
19+
<dllmap dll="python26.dll" target="/usr/lib/libpython2.6.dylib" os="!windows" />
20+
</configuration>
21+

doc/TODO.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
TODO list
2+
=========
3+
4+
For PythonNet 2.0
5+
-----------------
6+
7+
* Implement support for ModulePropertyAttribute.
8+
9+
* Replace CLRModule.preload code with ModulePropertyAttribute specific code.
10+
11+
* Deprecate implicit loading of assemblies
12+
13+
* Debug failing unit tests under Mono and report them if they are caused
14+
by incompatibilities in Mono.
15+
16+
Future and nice-to-have features
17+
--------------------------------
18+
19+
* Add support for Python's debug builds. Debug builds have additional fields
20+
in the struct, extensive self testing and C assert() are enabled. Py_DEBUG
21+
implies Py_TRACE_REFS and Py_REF_DEBUG which enlarge the PyObject and
22+
PyVarObject based structs. The Py_INCREF and Py_DECREF macros have a larger
23+
payload as well. They keep track of the absolute number of references and
24+
do tests when an object is GCed.
25+
I've taken care of most of the incompatibilities but the Py_DEBUG build
26+
is still broken. Somehow tp_mro of wrapper_descriptor isn't a tuple.
27+
28+
* Support Python 2.6. The most important feature I was able to isolate is the
29+
PyType_FastSubclass macro and related TypeFlags in interops.cs.
30+
31+
* Let's talk to the Debian and Ubuntu maintainers for Python in order to convince
32+
them to build Python with --enable-shared. Ubuntu's Python is semi static and not
33+
linked against libpython2.x.so. This causes trouble with clr.so.
34+

pythonnet/doc/changes.txt renamed to doc/changes.txt

Lines changed: 105 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,108 @@
1-
PythonNet Changes
2-
-----------------
1+
Python for .NET Changes
2+
-----------------------
3+
4+
PythonNet 2.0 alpha 2
5+
---------------------------------------------------------------------------
6+
7+
- First work on Python 2.5 compatibility. The destination version can be
8+
set by defining PYTHON24 or PYTHON25. Python 2.6 compatibility is in
9+
work. [tiran]
10+
11+
- Added VS 2005 solution and project files including a UnitTest
12+
configuration which runs the unit test suite. [tiran]
13+
14+
- Enhanced unit test suite. All test cases are combined in a single
15+
test suite now. [tiran]
16+
17+
- Fixed bugs in generics support for all Python versions. [tiran]
18+
19+
- Fixed exception bugs for Python 2.5+. When compiled for Python 2.5+ all
20+
managed exceptions are based on Python's exceptions.Exception class.
21+
[tiran]
22+
23+
- Added deprecation warnings for importing from CLR.* and the CLR module.
24+
[tiran]
25+
26+
- Implemented support for methods with variable arguments
27+
spam(params object[] egg) [tiran]
28+
29+
- Fixed Mono support by adding a custom marshaler for UCS-4 unicode,
30+
fixing a some ref counter bugs and creating a new makefile.mono.
31+
[tiran]
32+
33+
- Added a standard python extension to load the clr environment.
34+
The src/monoclr/ directory contains additional sample code like a
35+
Python binary linked against libpython2.x.so and some example code
36+
how to embed Mono and PythonNet in a C application.
37+
[tiran]
38+
39+
- Added yet another python prompt. This time it's a C application that
40+
embedds both Python and Mono. It may be useful as an example app for
41+
others and I need it to debug a nasty bug. [tiran]
42+
43+
- Implemented ModuleFunctionAttribute and added ForbidPythonThreadsAttribute.
44+
The latter is required for module functions which invoke Python methods.
45+
[tiran]
46+
47+
- Added clr.setPreload(), clr.getPreload(), clr.AddReference("assembly name"),
48+
clr.FindAssembly("name") and clr.ListAssemblies(verbose). Automatic
49+
preloading can be enabled with clr.setPreload/True). Preloading is
50+
automatically enabled for interactive Python shells and disabled in all
51+
other cases. [tiran]
52+
53+
- New Makefile that works for Windows and Mono and autodetects the Python
54+
version and UCS 2/4 setting. [tiran]
55+
56+
- Added code for Python 2.3. PythonNet can be build for Python 2.3 again
57+
but it is not fully supported. [tiran]
58+
59+
- Changed the PythonException.Message value so it displays the name of
60+
the exception class ("Exception") instead of its representation
61+
("<type 'exceptions.Exception'>").
62+
63+
- Added Python.Runtime.dll.config
64+
65+
66+
PythonNet 2.0 alpha 1
67+
---------------------------------------------------------------------------
68+
69+
- Moved the Python for .NET project to Sourceforge and moved version
70+
control to Subversion.
71+
72+
- Removed CallConvCdecl attributes and the IL hack that they supported.
73+
.NET 2.x now supports UnmanagedFunctionPointer, which does the right
74+
thing without the hackery required in 1.x. This removes a dependency
75+
on ILASM to build the package and better supports Mono (in theory).
76+
77+
- Refactored import and assembly management machinery. The old 'CLR.'
78+
syntax for import is deprecated, but still supported until 3.x. The
79+
recommended style now is to use 'from System import xxx', etc. We
80+
also now support 'from X import *' correctly.
81+
82+
- Implemented a (lowercase) 'clr' module to match IronPython for code
83+
compatibility. Methods of this module should be used to explicitly
84+
load assemblies. Implicit (name-based) assembly loading will still
85+
work until 3.x, but it is deprecated.
86+
87+
- Implemented support for generic types and generic methods using the
88+
same patterns and syntax as IronPython. See the documentation for
89+
usage details.
90+
91+
- Many small and large performance improvements, switched to generic
92+
collections for some internals, better algorithms for assembly
93+
scanning, etc.
94+
95+
- Fixed an unboxing issue in generated delegate implementation code
96+
that affected delegates that return value types.
97+
98+
99+
PythonNet 1.0 final
100+
---------------------------------------------------------------------------
101+
102+
- Backported the refactored import and assembly management from the 2.x
103+
line, mainly to improve the possibility of code-compatibility with
104+
IronPython.
105+
3106

4107
PythonNet 1.0 release candidate 2
5108
---------------------------------------------------------------------------

doc/mono_config.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!-- Mono Config for PythonNet
2+
3+
Copy this file to ~/.mono/config or add the dllmaps to the global
4+
configuration file /etc/mono/config
5+
-->
6+
7+
<configuration>
8+
<dllmap dll="python23" target="libpython2.3.so" os="!windows" />
9+
<dllmap dll="python24" target="libpython2.4.so" os="!windows" />
10+
<dllmap dll="python25" target="libpython2.5.so" os="!windows" />
11+
<dllmap dll="python26" target="libpython2.6.so" os="!windows" />
12+
<dllmap dll="python23.dll" target="libpython2.3.so" os="!windows" />
13+
<dllmap dll="python24.dll" target="libpython2.4.so" os="!windows" />
14+
<dllmap dll="python25.dll" target="libpython2.5.so" os="!windows" />
15+
<dllmap dll="python26.dll" target="libpython2.6.so" os="!windows" />
16+
</configuration>
17+

0 commit comments

Comments
 (0)
0