Skip to content

Support Ironpython3.4 #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
- 2022-12-16 **2.0.0**
- Add support IronPython 3.4 [#136](https://github.com/architecture-building-systems/revitpythonshell/pull/136)
- Please follow [Upgrade from IronPython2 to IronPython 3](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/upgrading-from-ipy2.md) to upgrade your code.
- 2022-09-22 **1.0.2**
- Fix set CollectorExt.m_app error. [#128](https://github.com/architecture-building-systems/revitpythonshell/pull/128)
- 2022-06-27 **1.0.1**
- Add Process CI/CD Automatic.
- Fix Problem show owner window.
Expand Down
2 changes: 1 addition & 1 deletion Installer/Installer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const string projectName = "RevitPythonShell";
const string outputName = "RevitPythonShell";
const string outputDir = "output";
const string version = "1.0.1";
const string version = "2.0.0";

var fileName = new StringBuilder().Append(outputName).Append("-").Append(version);
var project = new Project
Expand Down
4 changes: 2 additions & 2 deletions Installer/Installer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WixSharp.bin">
<Version>1.19.*</Version>
<Version>1.20.2</Version>
</PackageReference>
<PackageReference Include="WixSharp.wix.bin">
<Version>3.11.*</Version>
<Version>3.11.2</Version>
</PackageReference>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected void PopulateFromPythonType(List<PythonCompletionData> items, string n
//string dirCommand = "dir(" + objectName + ")";
string dirCommand = "sorted([m for m in dir(" + name + ") if not m.startswith('__')], key = str.lower) + sorted([m for m in dir(" + name + ") if m.startswith('__')])";
object value = commandLine.ScriptScope.Engine.CreateScriptSourceFromString(dirCommand, SourceCodeKind.Expression).Execute(commandLine.ScriptScope);
foreach (object member in (value as IronPython.Runtime.List))
foreach (object member in (value as IronPython.Runtime.PythonList))
{
bool isInstance = false;

Expand Down
1 change: 1 addition & 0 deletions PythonConsoleControl/PythonConsoleControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AvalonEdit" Version="6.0.1" />
<PackageReference Include="IronPython" Version="3.4.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="IronPython">
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,24 @@ database exploration tool to become a Revit API Ninja :)
- `lookup()` function for snooping `Element`, `ElementSet` and `ElementId` objects
in [RevitLookup](https://github.com/jeremytammik/RevitLookup)

## IronPython 3

IronPython 3.4 uses Python 3.4 syntax and standard libraries and so your Python code will need to be updated accordingly. There are numerous tools and guides available on the web to help porting from Python 2 to 3.

IronPython 3 targets Python 3, including the re-organized standard library, Unicode strings, and all of the other new features.with user upgrade from **IronPython 2** to **IronPython 3**, please follow [Upgrade from IronPython 2 to IronPython 3](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/upgrading-from-ipy2.md).

Various differences between IronPython and CPython can follow at [Differences IronPython and CPython](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/differences-from-c-python.md).

## Installation

Please follow last release at section [Release](https://github.com/architecture-building-systems/revitpythonshell/releases/latest) support version Support From Revit 2018-2023.

Older versions:
- [Installer for Autodesk Revit 2018 to Revit 2023](https://github.com/architecture-building-systems/revitpythonshell/releases/tag/1.0.1)
- [Installer for Autodesk Revit 2022](https://github.com/architecture-building-systems/revitpythonshell/releases/download/2021.06.20/2021.06.20_Setup_RevitPythonShell_2022.exe)
- [Installer for Autodesk Revit 2021](https://github.com/architecture-building-systems/revitpythonshell/releases/download/2021.03.22/2021.03.22_Setup_RevitPythonShell_2021.exe)
- [Installer for Autodesk Revit 2020](https://github.com/architecture-building-systems/revitpythonshell/releases/download/2019.01.27/2020.01.19_Setup_RevitPythonShell_2020.exe)
- [Installer for Autodesk Revit 2019](https://github.com/architecture-building-systems/revitpythonshell/releases/download/2018.09.19/2018.09.19_Setup_RevitPythonShell_2019.exe)
- [Installer for Autodesk Revit 2018 (and 2018.1)](https://github.com/architecture-building-systems/revitpythonshell/releases/download/2017.07.24/2017.07.24_Setup_RevitPythonShell_2018.exe)
- [Installer for Autodesk Revit 2017](https://github.com/architecture-building-systems/revitpythonshell/releases/download/2017.04.06/2017.04.06_Setup_RevitPythonShell_2017.exe)
- [Installer for Autodesk Revit 2016](https://github.com/architecture-building-systems/revitpythonshell/releases/download/2017.03.07/2017.03.07_Setup_RevitPythonShell_2016.exe)
- [Installer for Autodesk Revit 2015](https://github.com/architecture-building-systems/revitpythonshell/releases/download/2017.03.07/2017.03.07_Setup_RevitPythonShell_2015.exe)
Expand Down
Binary file removed RequiredLibraries/IronPython.Modules.dll
Binary file not shown.
Binary file removed RequiredLibraries/IronPython.SQLite.dll
Binary file not shown.
Binary file removed RequiredLibraries/IronPython.Wpf.dll
Binary file not shown.
Binary file removed RequiredLibraries/IronPython.dll
Binary file not shown.
Binary file removed RequiredLibraries/Microsoft.CSharp.dll
Binary file not shown.
Binary file removed RequiredLibraries/Microsoft.Dynamic.dll
Binary file not shown.
Binary file removed RequiredLibraries/Microsoft.Scripting.AspNet.dll
Binary file not shown.
Binary file removed RequiredLibraries/Microsoft.Scripting.Metadata.dll
Binary file not shown.
Binary file removed RequiredLibraries/Microsoft.Scripting.dll
Binary file not shown.
Binary file not shown.
Binary file removed RequiredLibraries/WPG.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion RevitPythonShell/Examples/helloworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
helloworld.py - example RevitPythonShell script
for testing the DeployRpsAddin program.
'''
print 'hello, world :)'
print("Hello World!")
Binary file added RpsRuntime/Resources/IronPython.3.4.0.zip
Binary file not shown.
65 changes: 35 additions & 30 deletions RpsRuntime/RpsRuntime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore"/>
<Reference Include="PresentationFramework"/>
<Reference Include="WindowsBase"/>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Nice3point.Revit.Api.RevitAPI" Version="$(RevitVersion).*"/>
<PackageReference Include="Nice3point.Revit.Api.RevitAPIUI" Version="$(RevitVersion).*"/>
<PackageReference Include="AvalonEdit" Version="6.0.1"/>
<PackageReference Include="DynamicLanguageRuntime" Version="1.3.3" />
<PackageReference Include="IronPython" Version="3.4.0" />
<PackageReference Include="Nice3point.Revit.Api.RevitAPI" Version="$(RevitVersion).*" />
<PackageReference Include="Nice3point.Revit.Api.RevitAPIUI" Version="$(RevitVersion).*" />
<PackageReference Include="AvalonEdit" Version="6.0.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="IronPython">
Expand All @@ -82,34 +84,34 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="PresentationCore"/>
<Reference Include="System"/>
<Reference Include="System.Core"/>
<Reference Include="System.Drawing"/>
<Reference Include="System.Windows.Forms"/>
<Reference Include="System.Xaml"/>
<Reference Include="System.Xml.Linq"/>
<Reference Include="System.Data.DataSetExtensions"/>
<Reference Include="System.Data"/>
<Reference Include="System.Xml"/>
<Reference Include="WindowsBase"/>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="ExternalCommandAssemblyBuilder.cs"/>
<Compile Include="IRpsConfig.cs"/>
<Compile Include="RpsConfig.cs"/>
<Compile Include="RpsExternalApplicationBase.cs"/>
<Compile Include="RpsExternalCommandBase.cs"/>
<Compile Include="RpsExternalCommandScriptBase.cs"/>
<Compile Include="ScriptExecutor.cs"/>
<Compile Include="ExternalCommandAssemblyBuilder.cs" />
<Compile Include="IRpsConfig.cs" />
<Compile Include="RpsConfig.cs" />
<Compile Include="RpsExternalApplicationBase.cs" />
<Compile Include="RpsExternalCommandBase.cs" />
<Compile Include="RpsExternalCommandScriptBase.cs" />
<Compile Include="ScriptExecutor.cs" />
<Compile Include="ScriptOutput.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ScriptOutput.Designer.cs">
<DependentUpon>ScriptOutput.cs</DependentUpon>
</Compile>
<Compile Include="ScriptOutputStream.cs"/>
<Compile Include="SettingsDictionary.cs"/>
<Compile Include="ScriptOutputStream.cs" />
<Compile Include="SettingsDictionary.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ScriptOutput.resx">
Expand All @@ -118,15 +120,18 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\PythonScript16x16.png"/>
<EmbeddedResource Include="Resources\PythonScript16x16.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\PythonScript32x32.png"/>
<EmbeddedResource Include="Resources\PythonScript32x32.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\python_27_lib.zip"/>
<EmbeddedResource Include="Resources\python_27_lib.zip" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\"/>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\IronPython.3.4.0.zip" />
</ItemGroup>
</Project>
5 changes: 3 additions & 2 deletions RpsRuntime/ScriptExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ private void AddEmbeddedLib(ScriptEngine engine)
{
// use embedded python lib
var asm = this.GetType().Assembly;
var resQuery = from name in asm.GetManifestResourceNames()
where name.ToLowerInvariant().EndsWith("python_27_lib.zip")
string[] resourceNames = asm.GetManifestResourceNames();
var resQuery = from name in resourceNames
where name.ToLowerInvariant().EndsWith("ironpython.3.4.0.zip")
select name;
var resName = resQuery.Single();
var importer = new IronPython.Modules.ResourceMetaPathImporter(asm, resName);
Expand Down