Skip to content

Commit d1c8af4

Browse files
authored
Merge pull request python#6 from paulmon/win-arm32-decimal
fix _decimal.pyd build for windows arm32
2 parents dbb9be6 + 820f3cc commit d1c8af4

File tree

5 files changed

+31
-12
lines changed

5 files changed

+31
-12
lines changed

Modules/_decimal/libmpdec/bits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ mpd_bsf(mpd_size_t a)
145145
}
146146
/* END ASM */
147147

148-
#elif defined(MASM)
148+
#elif defined(MASM) || defined (_M_ARM)
149149
#include <intrin.h>
150150
/*
151151
* Bit scan reverse. Assumptions: a != 0.

PCbuild/_decimal.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<PreprocessorDefinitions Condition="'$(Platform)'!='ARM'">_CRT_SECURE_NO_WARNINGS;MASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8181
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8282
<PreprocessorDefinitions Condition="'$(Platform)' == 'Win32'">CONFIG_32;PPRO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
83-
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">CONFIG_32;PPRO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
83+
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">CONFIG_32;ANSI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8484
<PreprocessorDefinitions Condition="'$(Platform)' == 'x64'">CONFIG_64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8585
<AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
8686
</ClCompile>

PCbuild/pcbuild.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ Global
208208
{28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.ActiveCfg = Release|x64
209209
{28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.Build.0 = Release|x64
210210
{0E9791DB-593A-465F-98BC-681011311617}.Debug|ARM.ActiveCfg = Debug|ARM
211+
{0E9791DB-593A-465F-98BC-681011311617}.Debug|ARM.Build.0 = Debug|ARM
211212
{0E9791DB-593A-465F-98BC-681011311617}.Debug|Win32.ActiveCfg = Debug|Win32
212213
{0E9791DB-593A-465F-98BC-681011311617}.Debug|Win32.Build.0 = Debug|Win32
213214
{0E9791DB-593A-465F-98BC-681011311617}.Debug|x64.ActiveCfg = Debug|x64

Tools/winiot/build.bat

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ set REBUILD=
1212
set DEBUG=
1313
set TEST=
1414
set _SUFFIX=
15+
set CLEAN=
1516

1617
:CheckOpts
1718
if "%~1" EQU "-h" goto Help
1819
if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
1920
if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
2021
if "%~1" EQU "-arm" (set BUILDARM=1) && shift && goto CheckOpts
22+
if "%~1" EQU "-c" (set CLEAN=-c) && shift && goto CheckOpts
2123
if "%~1" EQU "-t" (set TEST=-t) && shift && goto CheckOpts
2224
if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts
2325
if "%~1" EQU "-d" (set DEBUG=-d && set _SUFFIX=_d) && shift && goto CheckOpts
@@ -38,23 +40,23 @@ if defined BUILDX86 (
3840
) else if not exist "%Py_OutDir%win32\python%_SUFFIX%.exe" call "%PCBUILD%build.bat" -e %DEBUG%
3941
if errorlevel 1 goto :eof
4042

41-
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% -p win32
43+
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% %CLEAN% -p win32
4244
)
4345

4446
if defined BUILDX64 (
4547
if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r
4648
) else if not exist "%Py_OutDir%amd64\python%_SUFFIX%.exe" call "%PCBUILD%build.bat" -p x64 -e %DEBUG%
4749
if errorlevel 1 goto :eof
4850

49-
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% -p amd64
51+
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% %CLEAN% -p amd64
5052
)
5153

5254
if defined BUILDARM (
5355
if defined REBUILD ( call "%PCBUILD%build.bat" -p ARM -e %DEBUG% -r --no-tkinter --no-vs
5456
) else if not exist "%Py_OutDir%arm32\python%_SUFFIX%.exe" call "%PCBUILD%build.bat" -p ARM -E %DEBUG% --no-tkinter --no-vs
5557
if errorlevel 1 goto :eof
5658

57-
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% -p arm32
59+
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% %CLEAN% -p arm32
5860
)
5961

6062
exit /B 0
@@ -66,6 +68,7 @@ echo -x86 Build and sync x86 files
6668
echo -x64 Build and sync x64 files
6769
echo -arm Build and sync arm files (will build X64 to execute tools)
6870
echo -t Include test files
71+
echo -c Clean output directory
6972
echo -d Build Debug configuration
7073
echo -r Rebuild rather than incremental build
7174
echo -h Show usage

Tools/winiot/sync_win_iot.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,18 @@
5050

5151
EXCLUDED_FILES = {
5252
'pyshellext',
53+
'pyshellext_d'
54+
}
55+
56+
INCLUDED_FILES = {
57+
'libcrypto-1_1',
58+
'libssl-1_1',
5359
}
5460

5561
def is_debug(p):
62+
if p.stem.lower() in INCLUDED_FILES:
63+
return True
64+
5665
if p.stem.lower() in EXCLUDED_FILES:
5766
return False
5867

@@ -165,10 +174,13 @@ def copy_to_layout(target, rel_sources):
165174
pass
166175

167176
if dest.is_file():
168-
dest.chmod(stat.S_IWRITE)
177+
timeNotEqual = True if s.stat().st_mtime !=dest.stat().st_mtime else False
178+
sizeNotEqual = True if s.stat().st_size != dest.stat().st_size else False
169179

170-
shutil.copy2(str(s), str(dest))
171-
count += 1
180+
if not dest.is_file() or timeNotEqual or sizeNotEqual:
181+
print(dest)
182+
shutil.copy2(str(s), str(dest))
183+
count += 1
172184

173185
return count
174186

@@ -188,6 +200,7 @@ def main():
188200
global includeTest
189201

190202
parser = argparse.ArgumentParser()
203+
parser.add_argument('-c', '--clean', help='Clean output directory', action='store_true', default=False)
191204
parser.add_argument('-d', '--debug', help='Include debug files', action='store_true', default=False)
192205
parser.add_argument('-p', '--platform', metavar='dir', help='One of win32, amd64, or arm32', type=Path, default=None)
193206
parser.add_argument('-t', '--test', help='Include test files', action='store_true', default=False)
@@ -215,11 +228,13 @@ def main():
215228
print ('source = {}'.format(source))
216229
print ('output = {}'.format(output))
217230

218-
print ('clean output directory')
219-
shutil.rmtree(output)
231+
if ns.clean:
232+
print ('clean output directory')
233+
shutil.rmtree(output)
220234

221-
print ('create output directory')
222-
os.mkdir(output)
235+
if not output.is_dir():
236+
print ('create output directory')
237+
os.mkdir(output)
223238

224239
assert isinstance(repo, Path)
225240
assert isinstance(source, Path)

0 commit comments

Comments
 (0)