Skip to content

Commit

Permalink
Merge pull request python#6 from paulmon/win-arm32-decimal
Browse files Browse the repository at this point in the history
fix _decimal.pyd build for windows arm32
  • Loading branch information
paulmon authored Sep 29, 2018
2 parents dbb9be6 + 820f3cc commit d1c8af4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Modules/_decimal/libmpdec/bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ mpd_bsf(mpd_size_t a)
}
/* END ASM */

#elif defined(MASM)
#elif defined(MASM) || defined (_M_ARM)
#include <intrin.h>
/*
* Bit scan reverse. Assumptions: a != 0.
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_decimal.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<PreprocessorDefinitions Condition="'$(Platform)'!='ARM'">_CRT_SECURE_NO_WARNINGS;MASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)' == 'Win32'">CONFIG_32;PPRO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">CONFIG_32;PPRO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">CONFIG_32;ANSI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)' == 'x64'">CONFIG_64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
Expand Down
1 change: 1 addition & 0 deletions PCbuild/pcbuild.sln
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ Global
{28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.ActiveCfg = Release|x64
{28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.Build.0 = Release|x64
{0E9791DB-593A-465F-98BC-681011311617}.Debug|ARM.ActiveCfg = Debug|ARM
{0E9791DB-593A-465F-98BC-681011311617}.Debug|ARM.Build.0 = Debug|ARM
{0E9791DB-593A-465F-98BC-681011311617}.Debug|Win32.ActiveCfg = Debug|Win32
{0E9791DB-593A-465F-98BC-681011311617}.Debug|Win32.Build.0 = Debug|Win32
{0E9791DB-593A-465F-98BC-681011311617}.Debug|x64.ActiveCfg = Debug|x64
Expand Down
9 changes: 6 additions & 3 deletions Tools/winiot/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ set REBUILD=
set DEBUG=
set TEST=
set _SUFFIX=
set CLEAN=

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

%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% -p win32
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% %CLEAN% -p win32
)

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

%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% -p amd64
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% %CLEAN% -p amd64
)

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

%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% -p arm32
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% %CLEAN% -p arm32
)

exit /B 0
Expand All @@ -66,6 +68,7 @@ echo -x86 Build and sync x86 files
echo -x64 Build and sync x64 files
echo -arm Build and sync arm files (will build X64 to execute tools)
echo -t Include test files
echo -c Clean output directory
echo -d Build Debug configuration
echo -r Rebuild rather than incremental build
echo -h Show usage
29 changes: 22 additions & 7 deletions Tools/winiot/sync_win_iot.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,18 @@

EXCLUDED_FILES = {
'pyshellext',
'pyshellext_d'
}

INCLUDED_FILES = {
'libcrypto-1_1',
'libssl-1_1',
}

def is_debug(p):
if p.stem.lower() in INCLUDED_FILES:
return True

if p.stem.lower() in EXCLUDED_FILES:
return False

Expand Down Expand Up @@ -165,10 +174,13 @@ def copy_to_layout(target, rel_sources):
pass

if dest.is_file():
dest.chmod(stat.S_IWRITE)
timeNotEqual = True if s.stat().st_mtime !=dest.stat().st_mtime else False
sizeNotEqual = True if s.stat().st_size != dest.stat().st_size else False

shutil.copy2(str(s), str(dest))
count += 1
if not dest.is_file() or timeNotEqual or sizeNotEqual:
print(dest)
shutil.copy2(str(s), str(dest))
count += 1

return count

Expand All @@ -188,6 +200,7 @@ def main():
global includeTest

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

print ('clean output directory')
shutil.rmtree(output)
if ns.clean:
print ('clean output directory')
shutil.rmtree(output)

print ('create output directory')
os.mkdir(output)
if not output.is_dir():
print ('create output directory')
os.mkdir(output)

assert isinstance(repo, Path)
assert isinstance(source, Path)
Expand Down

0 comments on commit d1c8af4

Please sign in to comment.