Skip to content

Commit 6eac0ea

Browse files
authored
Provide README for zip package (#1582)
1 parent 31b6a21 commit 6eac0ea

5 files changed

Lines changed: 63 additions & 6 deletions

File tree

Build/Tasks.Targets

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,22 @@
2929
using ZipArchive archive = new ZipArchive(zipStream, ZipArchiveMode.Create);
3030
3131
foreach (ITaskItem fileItem in Files) {
32-
var filename = fileItem.ItemSpec;
33-
var fi = new FileInfo(filename);
32+
string evaluatedInclude = fileItem.ItemSpec;
33+
var fi = new FileInfo(evaluatedInclude);
3434
if (!fi.FullName.StartsWith(di.FullName)) {
35-
Log.LogError(string.Format("{0} not in {1}", filename, WorkingDirectory));
35+
Log.LogError(string.Format("{0} not in {1}", evaluatedInclude, WorkingDirectory));
3636
return (Success = false);
3737
}
38+
string filename = fileItem.GetMetadata("Link");
39+
if (string.IsNullOrEmpty(filename)) {
40+
filename = fi.FullName;
41+
}
3842
var archivename = fi.FullName.Substring(di.FullName.Length).Replace('\\', '/').TrimStart(new char [] { '/' });
3943
bool isExe = archivename.EndsWith(".ps1") || archivename.EndsWith(".sh");
4044
4145
ZipArchiveEntry entry = archive.CreateEntry(archivename);
4246
using Stream fileStreamInZip = entry.Open();
43-
using Stream fileStream = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read);
47+
using Stream fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
4448
4549
fileStream.CopyTo(fileStreamInZip);
4650
//entry.ExternalAttributes = isExe ? exeAttr : regAttr;

Package/dotnettool/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ This package contains a standalone Python interpreter, invokable from the comman
77

88
The current target is Python 3.4, although features and behaviors from later versions may be included. Refer to the [source code repository](https://github.com/IronLanguages/ironpython3) for list of features from each version of CPython that have been implemented.
99

10-
1110
## Differences with CPython
11+
1212
While compatibility with CPython is one of our main goals with IronPython 3, there are still some differences that may cause issues. See [Differences from CPython](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/differences-from-c-python.md) for details.
1313

1414
## Package compatibility
15+
1516
See the [Package compatibility](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/package-compatibility.md) document for information on compatibility with popular Python packages.

Package/nuget/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ System.Console.WriteLine(greetings("world"));
2121
```
2222

2323
## Differences with CPython
24+
2425
While compatibility with CPython is one of our main goals with IronPython 3, there are still some differences that may cause issues. See [Differences from CPython](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/differences-from-c-python.md) for details.
2526

2627
## Package compatibility
28+
2729
See the [Package compatibility](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/package-compatibility.md) document for information on compatibility with popular Python packages. Note that to run most packages, IronPython Standard Library must be present.

Package/zip/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
IronPython
2+
==========
3+
4+
IronPython is an open-source implementation of the Python programming language that is tightly integrated with .NET. IronPython can use .NET and Python libraries, and other .NET languages can use Python code just as easily.
5+
6+
This archive contains the IronPython executables usable for all supported platforms and systems. The executables require a .NET Runtime to be present on the system (not necessarily a .NET SDK). The archive also includes the Python Standard Library released by the Python project, but slightly modified to work better with IronPython and .NET.
7+
8+
The current target is Python 3.4, although features and behaviors from later versions may be included. Refer to the [source code repository](https://github.com/IronLanguages/ironpython3) for list of features from each version of CPython that have been implemented.
9+
10+
## Installation
11+
12+
After unpacking the archive, move or copy one of the `net` directories matching the desired runtime to use to a desired location. The name of the directory may be changed to something more appropriate, but its structure (subdirectories) should remain intact.
13+
14+
If access to the Python Standard Library is desired from IronPython, move or copy the whole `lib` directory **into** the moved/copied directory from the previous step. The `lib` directory has to be in the same directory as `IronPython.dll`.
15+
16+
## Command-line Usage
17+
18+
To start a command-line interpreter on Windows run `ipy.exe` (for .NET Framework) or `ipy.bat` (for .NET). On Posix systems, run `ipy.sh`. `ipy.sh` may be renamed to simply `ipy` for convenience.
19+
20+
Run `ipy -h` for a summary of command-line options. Most are identical to CPython, but there are a few IronPython-specific options.
21+
22+
When reporting issues on [IronPython Project Issues page](https://github.com/IronLanguages/ironpython3/issues), provide the output of `ipy -VV` in the report.
23+
24+
## Embedding IronPython Engine
25+
26+
To embed an IronPython interpreter in a .NET application, simply add references to the DLLs present in the installation directory to your project.
27+
28+
### Example
29+
30+
Execute Python code and call it from .NET code:
31+
32+
```cs
33+
var eng = IronPython.Hosting.Python.CreateEngine();
34+
var scope = eng.CreateScope();
35+
eng.Execute(@"if True:
36+
def greetings(name):
37+
return 'Hello ' + name.title() + '!'
38+
", scope);
39+
dynamic greetings = scope.GetVariable("greetings");
40+
System.Console.WriteLine(greetings("world"));
41+
```
42+
43+
## Differences with CPython
44+
45+
While compatibility with CPython is one of our main goals with IronPython 3, there are still some differences that may cause issues. See [Differences from CPython](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/differences-from-c-python.md) for details.
46+
47+
## Package compatibility
48+
49+
See the [Package compatibility](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/package-compatibility.md) document for information on compatibility with popular packages. Note that to run most packages, IronPython Standard Library must be present.

Package/zip/Zip.Packaging.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
<MakeDir Directories="$(PackageDir)" Condition="!Exists('$(PackageDir)')"/>
55

66
<ItemGroup>
7-
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\**\*.pdb;$(StageDir)\netcoreapp2.1\**\*;$(StageDir)\net7.0*\**\*" />
7+
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\README.md;$(StageDir)\**\*.pdb;$(StageDir)\netcoreapp2.1\**\*;$(StageDir)\net7.0*\**\*" />
8+
<ZipFiles Include="README.md" Link="$(MSBuildThisFileDirectory)README.md" />
89
</ItemGroup>
910
<Zip Files="@(ZipFiles)" ZipFileName="$(PackageDir)\IronPython.$(PackageVersion).zip" WorkingDirectory="$(StageDir)" />
1011

0 commit comments

Comments
 (0)