diff --git a/README.md b/README.md
index 192b279..e2f43a2 100644
--- a/README.md
+++ b/README.md
@@ -299,6 +299,34 @@ PACKAGE = Package("my_package", P1)
PACKAGE.members.append(P2)
```
+## Anonymous packages
+
+To install files directly into the target location (often ``site-packages``),
+use a top-level package with empty name. Other packages may be nested within
+this package as normal.
+
+```python
+PACKAGE = Package(
+ "",
+ File("module.pth"),
+ Package("module", ...),
+)
+```
+
+## Custom dist-info files
+
+To install files into the generated `.dist-info` directory, specify the
+``IncludeInDistinfo=True`` option. This will move the file in the built wheel,
+while reading it from its usual location. It will be included in the sdist at
+its source location.
+
+```python
+PACKAGE = Package(
+ "module",
+ File("entry_points.txt", IncludeInDistinfo=True),
+)
+```
+
## Wildcard handling
Files can be added recursively using wildcard operators. These are
diff --git a/pymsbuild/_build.py b/pymsbuild/_build.py
index c21735c..c7b56b1 100644
--- a/pymsbuild/_build.py
+++ b/pymsbuild/_build.py
@@ -102,6 +102,9 @@ def __init__(self, output_dir=None):
self.ext_suffix = None
self.platform = None
self.build_number = None
+ self.sdist_name = None
+ self.wheel_name = None
+ self.distinfo_name = None
self.python_cflags = None
self.python_ldflags = None
self.python_includes = None
@@ -309,6 +312,7 @@ def build(self, **properties):
properties.setdefault("OutDir", self.build_dir)
properties.setdefault("IntDir", self.temp_dir)
properties.setdefault("LayoutDir", self.layout_dir)
+ properties.setdefault("DistinfoDir", (self.metadata_dir / self.distinfo_name))
properties.setdefault("DefaultExtSuffix", self.ext_suffix)
properties.setdefault("PythonConfig", self.python_config)
properties.setdefault("PythonIncludes", self.python_includes)
diff --git a/pymsbuild/targets/common.targets b/pymsbuild/targets/common.targets
index a560e31..1103eb4 100644
--- a/pymsbuild/targets/common.targets
+++ b/pymsbuild/targets/common.targets
@@ -56,14 +56,14 @@
-
+
<_WithMetadata Remove="@(_WithMetadata)" />
- <_WithMetadata Include="@(AllSourceFiles)" Condition="%(AllSourceFiles.IncludeInWheel) == 'true'">
+ <_WithMetadata Include="@(AllSourceFiles)" Condition="%(AllSourceFiles.IncludeInDistinfo) == 'true'">
%(Filename)%(Extension)
<_WithMetadata>
@@ -71,7 +71,29 @@
$([System.IO.Path]::GetFileNameWithoutExtension(`%(_WithMetadata.Name)`))
$([System.IO.Path]::GetExtension(%(_WithMetadata.Name)))
-
+ <_WithMetadata>
+ $([msbuild]::EnsureTrailingSlash($([msbuild]::EnsureTrailingSlash($(DistinfoDir)))%(TargetDir)))%(TargetName)%(TargetExt)
+
+
+
+
+
+
+
+ <_WithMetadata Remove="@(_WithMetadata)" />
+
+
+
+
+ <_WithMetadata Include="@(AllSourceFiles)" Condition="%(AllSourceFiles.IncludeInWheel) == 'true' and %(AllSourceFiles.IncludeInDistinfo) != 'true'">
+ %(Filename)%(Extension)
+
+ <_WithMetadata>
+ $([msbuild]::EnsureTrailingSlash($([System.IO.Path]::GetDirectoryName(`%(_WithMetadata.Name)`))))
+ $([System.IO.Path]::GetFileNameWithoutExtension(`%(_WithMetadata.Name)`))
+ $([System.IO.Path]::GetExtension(%(_WithMetadata.Name)))
+
+
@@ -101,7 +123,7 @@
$([System.IO.Path]::GetFileNameWithoutExtension(`%(_WithMetadata.Name)`))
$([System.IO.Path]::GetExtension(%(_WithMetadata.Name)))
-
+
diff --git a/pymsbuild/targets/package.targets b/pymsbuild/targets/package.targets
index c2e2849..bb886b3 100644
--- a/pymsbuild/targets/package.targets
+++ b/pymsbuild/targets/package.targets
@@ -87,7 +87,7 @@
<_DistFiles Remove="@(_DistFiles)" />
<_DistFiles Include="@(PyMSBuild_PackageFiles)">
- $([msbuild]::EnsureTrailingSlash($([msbuild]::EnsureTrailingSlash($(LayoutDir)))%(TargetDir)))%(TargetName)%(TargetExt)
+ $([msbuild]::EnsureTrailingSlash($([msbuild]::EnsureTrailingSlash($(LayoutDir)))%(TargetDir)))%(TargetName)%(TargetExt)
@@ -96,7 +96,7 @@
<_DistFiles Remove="@(_DistFiles)" />
<_DistFiles Include="@(PyMSBuild_SDistFiles)">
- $([msbuild]::EnsureTrailingSlash($(LayoutDir)))%(RelativeSource)
+ $([msbuild]::EnsureTrailingSlash($(LayoutDir)))%(RelativeSource)
@@ -105,7 +105,7 @@
<_DistFiles Remove="@(_DistFiles)" />
<_DistFiles Include="@(PyMSBuild_LayoutFiles)" Condition="%(IncludeInLayout) == 'true'">
- $([msbuild]::EnsureTrailingSlash($([msbuild]::EnsureTrailingSlash($(_SourceLayoutDir)))%(TargetDir)))%(TargetName)%(TargetExt)
+ $([msbuild]::EnsureTrailingSlash($([msbuild]::EnsureTrailingSlash($(_SourceLayoutDir)))%(TargetDir)))%(TargetName)%(TargetExt)
<_Removing Include="@(_DistFiles)" Condition="%(FullPath) == %(Destination)" />