[ci] use raw strings in NuGet helper script (#2710)

This commit is contained in:
Nikita Titov 2020-01-27 03:07:25 +03:00 коммит произвёл James Lamb
Родитель d90642820d
Коммит ef0b2d8287
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -27,7 +27,7 @@ if __name__ == "__main__":
copy_file(os.path.join(source, "lib_lightgbm.dll"), os.path.join(windows_folder_path, "lib_lightgbm.dll")) copy_file(os.path.join(source, "lib_lightgbm.dll"), os.path.join(windows_folder_path, "lib_lightgbm.dll"))
copy_file(os.path.join(source, "lightgbm.exe"), os.path.join(windows_folder_path, "lightgbm.exe")) copy_file(os.path.join(source, "lightgbm.exe"), os.path.join(windows_folder_path, "lightgbm.exe"))
version = open(os.path.join(current_dir, os.path.pardir, 'VERSION.txt')).read().strip() version = open(os.path.join(current_dir, os.path.pardir, 'VERSION.txt')).read().strip()
nuget_str = '''<?xml version="1.0"?> nuget_str = r"""<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata> <metadata>
<id>LightGBM</id> <id>LightGBM</id>
@ -47,8 +47,8 @@ if __name__ == "__main__":
<file src="runtimes\**" target="runtimes"/> <file src="runtimes\**" target="runtimes"/>
</files> </files>
</package> </package>
''' % (version, datetime.datetime.now().year) """ % (version, datetime.datetime.now().year)
prop_str = ''' prop_str = r"""
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="Exists('packages.config') OR <ItemGroup Condition="Exists('packages.config') OR
Exists('$(MSBuildProjectName).packages.config') OR Exists('$(MSBuildProjectName).packages.config') OR
@ -65,8 +65,8 @@ if __name__ == "__main__":
</Content> </Content>
</ItemGroup> </ItemGroup>
</Project> </Project>
''' """
target_str = ''' target_str = r"""
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<EnableLightGBMUnsupportedPlatformTargetCheck Condition="'$(EnableLightGBMUnsupportedPlatformTargetCheck)' == ''">true</EnableLightGBMUnsupportedPlatformTargetCheck> <EnableLightGBMUnsupportedPlatformTargetCheck Condition="'$(EnableLightGBMUnsupportedPlatformTargetCheck)' == ''">true</EnableLightGBMUnsupportedPlatformTargetCheck>
@ -80,7 +80,7 @@ if __name__ == "__main__":
Text="LightGBM currently supports 'x64' processor architectures. Please ensure your application is targeting 'x64'." /> Text="LightGBM currently supports 'x64' processor architectures. Please ensure your application is targeting 'x64'." />
</Target> </Target>
</Project> </Project>
''' """
with open(os.path.join(current_dir, "LightGBM.nuspec"), "w") as nuget_file: with open(os.path.join(current_dir, "LightGBM.nuspec"), "w") as nuget_file:
nuget_file.write(nuget_str) nuget_file.write(nuget_str)
with open(os.path.join(current_dir, "build", "LightGBM.props"), "w") as prop_file: with open(os.path.join(current_dir, "build", "LightGBM.props"), "w") as prop_file: