mirror of
https://github.com/python/cpython.git
synced 2024-12-12 11:23:56 +08:00
62972d9d73
This is the initial implementation of PEP 615, the zoneinfo module, ported from the standalone reference implementation (see https://www.python.org/dev/peps/pep-0615/#reference-implementation for a link, which has a more detailed commit history). This includes (hopefully) all functional elements described in the PEP, but documentation is found in a separate PR. This includes: 1. A pure python implementation of the ZoneInfo class 2. A C accelerated implementation of the ZoneInfo class 3. Tests with 100% branch coverage for the Python code (though C code coverage is less than 100%). 4. A compile-time configuration option on Linux (though not on Windows) Differences from the reference implementation: - The module is arranged slightly differently: the accelerated module is `_zoneinfo` rather than `zoneinfo._czoneinfo`, which also necessitates some changes in the test support function. (Suggested by Victor Stinner and Steve Dower.) - The tests are arranged slightly differently and do not include the property tests. The tests live at test/test_zoneinfo/test_zoneinfo.py rather than test/test_zoneinfo.py or test/test_zoneinfo/__init__.py because we may do some refactoring in the future that would likely require this separation anyway; we may: - include the property tests - automatically run all the tests against both pure Python and C, rather than manually constructing C and Python test classes (similar to the way this works with test_datetime.py, which generates C and Python test cases from datetimetester.py). - This includes a compile-time configuration option on Linux (though not on Windows); added with much help from Thomas Wouters. - Integration into the CPython build system is obviously different from building a standalone zoneinfo module wheel. - This includes configuration to install the tzdata package as part of CI, though only on the coverage jobs. Introducing a PyPI dependency as part of the CI build was controversial, and this is seen as less of a major change, since the coverage jobs already depend on pip and PyPI. Additional changes that were introduced as part of this PR, most / all of which were backported to the reference implementation: - Fixed reference and memory leaks With much debugging help from Pablo Galindo - Added smoke tests ensuring that the C and Python modules are built The import machinery can be somewhat fragile, and the "seamlessly falls back to pure Python" nature of this module makes it so that a problem building the C extension or a failure to import the pure Python version might easily go unnoticed. - Adjustments to zoneinfo.__dir__ Suggested by Petr Viktorin. - Slight refactorings as suggested by Steve Dower. - Removed unnecessary if check on std_abbr Discovered this because of a missing line in branch coverage.
129 lines
6.1 KiB
XML
129 lines
6.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<PropertyGroup Label="Globals">
|
|
<ProjectGuid>{CC9B93A2-439D-4058-9D29-6DCF43774405}</ProjectGuid>
|
|
<Platform Condition="'$(Platform)' == ''">Win32</Platform>
|
|
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
|
|
<IncludeExtensions Condition="'$(IncludeExtensions)' == ''">true</IncludeExtensions>
|
|
<IncludeExternals Condition="'$(IncludeExternals)' == ''">true</IncludeExternals>
|
|
<IncludeTests Condition="'$(IncludeTest)' == ''">true</IncludeTests>
|
|
<IncludeCTypes Condition="'$(IncludeCTypes)' == ''">true</IncludeCTypes>
|
|
<IncludeSSL Condition="'$(IncludeSSL)' == ''">true</IncludeSSL>
|
|
<IncludeTkinter Condition="'$(IncludeTkinter)' == ''">true</IncludeTkinter>
|
|
<IncludeUwp Condition="'$(IncludeUwp)' == ''">false</IncludeUwp>
|
|
</PropertyGroup>
|
|
|
|
<ItemDefinitionGroup>
|
|
<Projects>
|
|
<Platform>$(Platform)</Platform>
|
|
<Configuration>$(Configuration)</Configuration>
|
|
<Properties></Properties>
|
|
<BuildTarget>Build</BuildTarget>
|
|
<CleanTarget>Clean</CleanTarget>
|
|
<CleanAllTarget>CleanAll</CleanAllTarget>
|
|
<BuildInParallel>true</BuildInParallel>
|
|
</Projects>
|
|
<Projects2>
|
|
<Platform>$(Platform)</Platform>
|
|
<Configuration>$(Configuration)</Configuration>
|
|
<Properties></Properties>
|
|
<BuildTarget>Build</BuildTarget>
|
|
<CleanTarget>Clean</CleanTarget>
|
|
<CleanAllTarget>CleanAll</CleanAllTarget>
|
|
<BuildInParallel>false</BuildInParallel>
|
|
</Projects2>
|
|
</ItemDefinitionGroup>
|
|
<ItemGroup>
|
|
<!-- pythonXY.dll -->
|
|
<!--
|
|
Parallel build is explicitly disabled for this project because it
|
|
causes many conflicts between pythoncore and projects that depend
|
|
on pythoncore. Once the core DLL has been built, subsequent
|
|
projects will be built in parallel.
|
|
-->
|
|
<Projects Include="pythoncore.vcxproj">
|
|
<BuildInParallel>false</BuildInParallel>
|
|
</Projects>
|
|
<!-- python3.dll -->
|
|
<Projects Include="python3dll.vcxproj" />
|
|
<!-- py[w].exe -->
|
|
<Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" />
|
|
<!-- pyshellext.dll -->
|
|
<Projects Include="pyshellext.vcxproj" />
|
|
<!-- Extension modules -->
|
|
<ExtensionModules Include="_asyncio;_zoneinfo;_decimal;_elementtree;_msi;_multiprocessing;_overlapped;pyexpat;_queue;select;unicodedata;winsound;_uuid" />
|
|
<ExtensionModules Include="_ctypes" Condition="$(IncludeCTypes)" />
|
|
<!-- Extension modules that require external sources -->
|
|
<ExternalModules Include="_bz2;_lzma;_sqlite3" />
|
|
<!-- venv launchers -->
|
|
<Projects Include="venvlauncher.vcxproj;venvwlauncher.vcxproj" />
|
|
<!-- _ssl will build _socket as well, which may cause conflicts in parallel builds -->
|
|
<ExtensionModules Include="_socket" Condition="!$(IncludeSSL) or !$(IncludeExternals)" />
|
|
<ExternalModules Include="_ssl;_hashlib" Condition="$(IncludeSSL)" />
|
|
<ExternalModules Include="_tkinter" Condition="$(IncludeTkinter) and $(Platform) != 'ARM' and $(Platform) != 'ARM64'" />
|
|
<ExtensionModules Include="@(ExternalModules->'%(Identity)')" Condition="$(IncludeExternals)" />
|
|
<Projects Include="@(ExtensionModules->'%(Identity).vcxproj')" Condition="$(IncludeExtensions)" />
|
|
<!-- Test modules -->
|
|
<TestModules Include="_ctypes_test;_testbuffer;_testcapi;_testinternalcapi;_testembed;_testimportmultiple;_testmultiphase;_testconsole" />
|
|
<TestModules Include="xxlimited" Condition="'$(Configuration)' == 'Release'" />
|
|
<Projects Include="@(TestModules->'%(Identity).vcxproj')" Condition="$(IncludeTests)">
|
|
<!-- Disable parallel build for test modules -->
|
|
<BuildInParallel>false</BuildInParallel>
|
|
</Projects>
|
|
|
|
<!-- _freeze_importlib -->
|
|
<Projects2 Condition="$(Platform) != 'ARM' and $(Platform) != 'ARM64'" Include="_freeze_importlib.vcxproj" />
|
|
<!-- python[w].exe -->
|
|
<Projects2 Include="python.vcxproj;pythonw.vcxproj" />
|
|
<Projects2 Include="python_uwp.vcxproj;pythonw_uwp.vcxproj" Condition="$(IncludeUwp)" />
|
|
<!-- venv[w]launcher.exe -->
|
|
<Projects2 Include="venvlauncher.vcxproj;venvwlauncher.vcxproj" />
|
|
</ItemGroup>
|
|
|
|
<Target Name="Build">
|
|
<MSBuild Projects="@(Projects)"
|
|
Properties="Configuration=%(Configuration);Platform=%(Platform);%(Properties)"
|
|
BuildInParallel="%(BuildInParallel)"
|
|
StopOnFirstFailure="true"
|
|
Targets="%(BuildTarget)" />
|
|
<MSBuild Projects="@(Projects2)"
|
|
Properties="Configuration=%(Configuration);Platform=%(Platform);%(Properties)"
|
|
BuildInParallel="%(BuildInParallel)"
|
|
StopOnFirstFailure="true"
|
|
Targets="%(BuildTarget)" />
|
|
</Target>
|
|
|
|
<Target Name="Clean">
|
|
<MSBuild Projects="@(Projects2)"
|
|
Properties="Configuration=%(Configuration);Platform=%(Platform);%(Properties)"
|
|
BuildInParallel="%(BuildInParallel)"
|
|
StopOnFirstFailure="false"
|
|
Condition="%(CleanTarget) != ''"
|
|
Targets="%(CleanTarget)" />
|
|
<MSBuild Projects="@(Projects)"
|
|
Properties="Configuration=%(Configuration);Platform=%(Platform);%(Properties)"
|
|
BuildInParallel="%(BuildInParallel)"
|
|
StopOnFirstFailure="false"
|
|
Condition="%(CleanTarget) != ''"
|
|
Targets="%(CleanTarget)" />
|
|
</Target>
|
|
|
|
<Target Name="CleanAll">
|
|
<MSBuild Projects="@(Projects2)"
|
|
Properties="Configuration=%(Configuration);Platform=%(Platform);%(Properties)"
|
|
BuildInParallel="%(BuildInParallel)"
|
|
StopOnFirstFailure="false"
|
|
Condition="%(CleanAllTarget) != ''"
|
|
Targets="%(CleanAllTarget)" />
|
|
<MSBuild Projects="@(Projects)"
|
|
Properties="Configuration=%(Configuration);Platform=%(Platform);%(Properties)"
|
|
BuildInParallel="%(BuildInParallel)"
|
|
StopOnFirstFailure="false"
|
|
Condition="%(CleanAllTarget) != ''"
|
|
Targets="%(CleanAllTarget)" />
|
|
</Target>
|
|
|
|
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
|
|
<Target Name="RebuildAll" DependsOnTargets="CleanAll;Build" />
|
|
</Project>
|