Skip to content

Commit 358ea50

Browse files
committed
Default to Python 2.5
Renamed solution file to pythonnet.sln. It's not Python 2.5 specific Enhanced make dist. It builds a signed assemblies for 2.4 and 2.5 for both UCS 2 and 4 with GPG keys, md5 and sha256 sum
1 parent a376c3a commit 358ea50

File tree

5 files changed

+78
-29
lines changed

5 files changed

+78
-29
lines changed

pythonnet/Makefile

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,32 @@
66
# make clean
77

88
RELEASE = pythonnet-2.0-alpha3
9+
KEYFILE = pythonnet.key
910

1011
PYTHON ?= python
1112
PYTHONVER ?= $(shell $(PYTHON) -c "import sys; print 'PYTHON%i%i' % sys.version_info[:2]")
1213
UCS ?= $(shell $(PYTHON) -c "from distutils.sysconfig import get_config_var; \
13-
print 'UCS%i' % (get_config_var('Py_UNICODE_SIZE') or 2)")
14+
print 'UCS%i' % (get_config_var('Py_UNICODE_SIZE') or 2)")
15+
SITEPACKAGES = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; \
16+
print get_python_lib(plat_specific=1, standard_lib=0)")
17+
INSTALL=/usr/bin/install -m644
1418

1519
ifeq ($(origin WINDIR), undefined)
1620
RUNNER = mono
1721
ILDASM = monodis
1822
ILASM = ilasm
1923
CSC = gmcs
20-
RUNTIME_REF = /reference:Mono.Posix.dll
24+
RUNTIME_REF =
2125
ALL = clr.so monoclr
26+
GACUTIL = gacutil /nologo
2227
else
2328
RUNNER =
2429
ILDASM = ildasm.exe
25-
ILASM = ilasm.exe
26-
CSC = csc.exe
30+
ILASM = $(WINDIR)/Microsoft.NET/Framework/v2.0.50727/ilasm.exe
31+
CSC = $(WINDIR)/Microsoft.NET/Framework/v2.0.50727/csc.exe
2732
RUNTIME_REF =
28-
ALL = clr.pyd
33+
ALL =
34+
GACUTIL = $(ProgramFiles)/Microsoft.NET/SDK/v2.0/Bin/gacutil.exe /nologo
2935
endif
3036

3137
ifeq ($(origin DEFINE), undefined)
@@ -34,6 +40,10 @@ else
3440
_DEFINE = $(DEFINE),$(PYTHONVER),$(UCS)
3541
endif
3642

43+
ifeq ($(UCS), UCS4)
44+
RUNTIME_REF = /reference:Mono.Posix.dll
45+
endif
46+
3747
CSC += /define:$(_DEFINE) /nologo $(CSCARGS)
3848

3949
BASEDIR = $(shell pwd)
@@ -43,9 +53,9 @@ RUNTIME_CS = $(wildcard $(BASEDIR)/src/runtime/*.cs)
4353
TESTING_CS = $(wildcard $(BASEDIR)/src/testing/*.cs)
4454
EMBED_CS = $(wildcard $(BASEDIR)/src/embed_tests/*.cs)
4555

46-
all: Python.Runtime.dll python.exe Python.Test.dll $(ALL)
56+
all: Python.Runtime.dll python.exe Python.Test.dll clr.pyd $(ALL)
4757

48-
cleanall: clean all
58+
cleanall: realclean all
4959

5060
python.exe: Python.Runtime.dll $(PYTHON_CS)
5161
cd "$(BASEDIR)/src/console"; \
@@ -74,8 +84,19 @@ Python.Test.dll: Python.Runtime.dll
7484
/reference:../../Python.Runtime.dll,System.Windows.Forms.dll \
7585
/recurse:*.cs
7686

87+
Python.EmbeddingTest.dll: Python.Runtime.dll $(EMBED_CS)
88+
cd $(BASEDIR)/src/embed_tests; \
89+
$(CSC) /target:library /out:../../Python.EmbeddingTest.dll \
90+
/reference:../../Python.Runtime.dll,System.Windows.Forms.dll,nunit.framework \
91+
/recurse:*.cs
92+
7793
.PHONY=clean
7894
clean:
95+
rm -f *.exe *.dll *.so *.pyd
96+
make -C src/monoclr clean
97+
98+
.PHONY=realclean
99+
realclean: clean
79100
find . \( -name \*.o -o -name \*.so -o -name \*.py[co] -o -name \
80101
\*.dll -o -name \*.exe -o -name \*.pdb -o -name \*.mdb \
81102
-o -name \*.pyd -o -name \*~ \) -exec rm -f {} \;
@@ -93,21 +114,36 @@ test: all
93114
$(RUNNER) ./python.exe ./src/tests/runtests.py
94115

95116
.PHONY=dist
96-
dist: clean all
117+
dist: realclean
118+
if ! [ -f $(KEYFILE) ]; then \
119+
echo "Could not find $(KEYFILE) to sign assemblies"; \
120+
exit 1; \
121+
fi
97122
rm -rf ./$(RELEASE)
123+
mkdir -p ./release/
98124
mkdir ./$(RELEASE)
99-
mkdir -p ./release
100-
cp ./makefile ./$(RELEASE)/
125+
cp ./Makefile ./$(RELEASE)/
101126
cp ./*.sln ./$(RELEASE)/
127+
cp ./*.mds ./$(RELEASE)/
102128
cp ./*.txt ./$(RELEASE)/
103129
svn export ./demo ./$(RELEASE)/demo/
104130
svn export ./doc ./$(RELEASE)/doc/
105131
svn export ./src ./$(RELEASE)/src/
106-
cp ./python.exe ./$(RELEASE)/
107-
cp ./*.dll ./$(RELEASE)/
108-
cp ./*.pyd ./$(RELEASE)/
109-
tar czf $(RELEASE).tgz ./$(RELEASE)/
110-
mv $(RELEASE).tgz ./release/
132+
for PY in python2.4 python2.5; do \
133+
for PYUCS in UCS2 UCS4; do \
134+
make clean; \
135+
make PYTHON=$$PY UCS=$$PYUCS CSCARGS=/keyfile:$(BASEDIR)/$(KEYFILE); \
136+
mkdir ./$(RELEASE)/$$PY-$$PYUCS; \
137+
cp *.dll *.exe *.pyd *.so ./$(RELEASE)/$$PY-$$PYUCS/; \
138+
done; \
139+
done;
140+
tar czf $(RELEASE).tar.gz ./$(RELEASE)/
141+
zip -r -6 $(RELEASE).zip ./$(RELEASE)
142+
md5sum $(RELEASE).tar.gz $(RELEASE).zip > $(RELEASE).md5
143+
sha256sum $(RELEASE).tar.gz $(RELEASE).zip > $(RELEASE).sha
144+
gpg -sb $(RELEASE).zip
145+
gpg -sb $(RELEASE).tar.gz
146+
mv $(RELEASE).* ./release/
111147
rm -rf ./$(RELEASE)/
112148

113149
dis:
@@ -124,3 +160,6 @@ monoclr:
124160
run: python.exe
125161
$(RUNNER) python.exe
126162

163+
install: all
164+
$(PYTHON) setup.py install
165+

pythonnet/setup.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
Author: Christian Heimes <christian(at)cheimes(dot)de>
1313
"""
1414

15-
from setuptools import setup
16-
from setuptools import Extension
15+
import os
16+
import sys
17+
from distutils.core import setup
18+
from distutils.core import Extension
1719
import subprocess
1820

21+
VERSION = "%i.%i" % sys.version_info[:2]
22+
1923
def pkgconfig(*packages, **kw):
2024
"""From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502261
2125
"""
@@ -44,6 +48,11 @@ def pkgconfig(*packages, **kw):
4448
**pkgconfig('mono')
4549
)
4650

51+
extensions = []
52+
if os.name == "posix":
53+
extensions.append(clr)
54+
4755
setup(name="clr",
48-
ext_modules = [clr],
56+
ext_modules = extensions,
57+
scripts = ["src/monoclr/clrpython%s" % VERSION],
4958
)

pythonnet/src/monoclr/Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Author: Christian Heimes
22

33
PYTHON = python2.5
4-
BASENAME = $(shell basename $(PYTHON))
4+
BASENAME = $(shell $(PYTHON) -c "import sys; print 'python%i.%i' % sys.version_info[:2]")
55
GCC = gcc
66

77
PY_LIBS = $(shell $(PYTHON) -c "from distutils.sysconfig import get_config_vars; \
@@ -15,9 +15,9 @@ MONO_CFLAGS = $(shell pkg-config --cflags mono)
1515
LIBS = $(MONO_LIBS) $(PY_LIBS)
1616
CFLAGS = $(MONO_CFLAGS) $(PY_CFLAGS)
1717

18-
all: clrpython python
18+
all: clr$(BASENAME) $(BASENAME)
1919

20-
clrpython: clrpython.o pynetinit.o
20+
clr$(BASENAME): clrpython.o pynetinit.o
2121
$(GCC) $(LIBS) clrpython.o pynetinit.o -o clr$(BASENAME)
2222

2323
clrpython.o: pynetclr.h clrpython.c
@@ -26,12 +26,13 @@ clrpython.o: pynetclr.h clrpython.c
2626
pynetinit.o: pynetclr.h pynetinit.c
2727
$(GCC) $(CFLAGS) -c pynetinit.c -o pynetinit.o
2828

29-
python: python.c
29+
$(BASENAME): python.c
3030
$(GCC) $(PY_CFLAGS) $(PY_LIBS) python.c -o $(BASENAME)
3131

3232
clean:
3333
rm -f *.o
3434
rm -f *.so
35-
rm -f clr$(PYTHON)
36-
rm -f $(PYTHON)
35+
rm -f clrpython2.?
36+
rm -f python2.?
3737
rm -rf build/
38+

pythonnet/src/runtime/Python.Runtime.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414
<DebugType>full</DebugType>
1515
<Optimize>true</Optimize>
1616
<OutputPath>.\bin\Debug\</OutputPath>
17-
<DefineConstants>TRACE;DEBUG;PYTHON24</DefineConstants>
17+
<DefineConstants>TRACE;DEBUG;PYTHON25,UCS2</DefineConstants>
1818
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1919
</PropertyGroup>
2020
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2121
<DebugType>pdbonly</DebugType>
2222
<Optimize>true</Optimize>
2323
<OutputPath>.\bin\Release\</OutputPath>
24-
<DefineConstants>TRACE;PYTHON24</DefineConstants>
24+
<DefineConstants>TRACE;PYTHON25,UCS2</DefineConstants>
2525
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
2626
</PropertyGroup>
2727
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'EmbeddingTest|AnyCPU' ">
2828
<DebugSymbols>true</DebugSymbols>
2929
<OutputPath>bin\EmbeddingTest\</OutputPath>
30-
<DefineConstants>TRACE;DEBUG;PYTHON24</DefineConstants>
30+
<DefineConstants>TRACE;DEBUG;PYTHON25,UCS2</DefineConstants>
3131
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
3232
<Optimize>true</Optimize>
3333
<DebugType>full</DebugType>
@@ -36,7 +36,7 @@
3636
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'UnitTests|AnyCPU' ">
3737
<DebugSymbols>true</DebugSymbols>
3838
<OutputPath>bin\UnitTests\</OutputPath>
39-
<DefineConstants>TRACE;DEBUG;PYTHON24</DefineConstants>
39+
<DefineConstants>TRACE;DEBUG;PYTHON25,UCS2</DefineConstants>
4040
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
4141
<Optimize>true</Optimize>
4242
<DebugType>full</DebugType>
@@ -115,4 +115,4 @@
115115
</PostBuildEvent>
116116
<PreBuildEvent>del "$(TargetDir)clr.pyd"</PreBuildEvent>
117117
</PropertyGroup>
118-
</Project>
118+
</Project>

0 commit comments

Comments
 (0)