File tree Expand file tree Collapse file tree 6 files changed +25
-27
lines changed
Expand file tree Collapse file tree 6 files changed +25
-27
lines changed Original file line number Diff line number Diff line change 1+ FROM python:3.10-slim
2+
3+ COPY . /Python_Toolkit
4+
5+ RUN pip3 install ./Python_Toolkit
6+
7+ RUN rm ./Python_Toolkit -rf
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ dependencies = [
2222source = " https://github.com/BHoM/Python_Toolkit"
2323
2424[build-system ]
25- requires = [" setuptools" , " pywin32 " ]
25+ requires = [" setuptools" ]
2626build-backend = " setuptools.build_meta"
2727
2828[dependency-groups ]
@@ -46,5 +46,8 @@ package-dir = {"" = "src"}
4646where = [" src" ]
4747exclude = [" tests" ]
4848
49+ [tool .setuptools .package-data ]
50+ "*" = [" *.mplstyle" ]
51+
4952[tool .pytest .ini_options ]
5053pythonpath = " src"
Original file line number Diff line number Diff line change 11from pathlib import Path
2-
32import setuptools
4- from win32api import HIWORD , LOWORD , GetFileVersionInfo
53
64TOOLKIT_NAME = "Python_Toolkit"
75
6+ here = Path (__file__ ).parent .resolve ()
7+
88def _bhom_version () -> str :
99 """Return the version of BHoM installed (using the BHoM.dll in the root BHoM directory."""
10- info = GetFileVersionInfo ("C:/ProgramData/BHoM/Assemblies/BHoM.dll" , "\\ " ) # pylint: disable=[no-name-in-module]
11- ms = info ["FileVersionMS" ]
12- ls = info ["FileVersionLS" ]
13- return f"{ HIWORD (ms )} .{ LOWORD (ms )} .{ HIWORD (ls )} .{ LOWORD (ls )} " # pylint: disable=[no-name-in-module]
10+ versionFile = here / "VERSION.txt" #version file is created in a pre-build event in Python_Engine.csproj
11+ return versionFile .read_text ();
1412
1513BHOM_VERSION = _bhom_version ()
1614
17- here = Path (__file__ ).parent .resolve ()
1815long_description = (here / "README.md" ).read_text (encoding = "utf-8" )
1916
2017setuptools .setup (
Original file line number Diff line number Diff line change 22
33from pathlib import Path # pylint: disable=E0401
44from os import path
5+ import tempfile
6+ import importlib .metadata
57
6- from win32api import HIWORD , LOWORD , GetFileVersionInfo
7-
8- BHOM_ASSEMBLIES_DIRECTORY = Path (path .expandvars ("%PROGRAMDATA%/BHoM/Assemblies" ))
98BHOM_LOG_FOLDER = Path (path .expandvars ("%PROGRAMDATA%/BHoM/Logs" ))
109TOOLKIT_NAME = "Python_Toolkit"
10+ BHOM_VERSION = importlib .metadata .version ("python_toolkit" )
1111
1212if not BHOM_LOG_FOLDER .exists ():
13- BHOM_LOG_FOLDER = Path (path .expandvars ("%TEMP%/BHoMLogs" ))
14- BHOM_LOG_FOLDER .mkdir (exist_ok = True )
15-
16- if not BHOM_ASSEMBLIES_DIRECTORY .exists ():
17- BHOM_VERSION = ""
18- else :
19- _file_version_ms = GetFileVersionInfo (
20- (BHOM_ASSEMBLIES_DIRECTORY / "BHoM.dll" ).as_posix (), "\\ "
21- )["FileVersionMS" ]
22-
23- BHOM_VERSION = f"{ HIWORD (_file_version_ms )} .{ LOWORD (_file_version_ms )} "
13+ BHOM_LOG_FOLDER = Path (tempfile .gettempdir ()) / "BHoM" / "Logs"
14+ BHOM_LOG_FOLDER .mkdir (exist_ok = True , parents = True )
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22 <PropertyGroup >
33 <TargetFramework >netstandard2.0</TargetFramework >
4- <AssemblyVersion >8 .0.0.0</AssemblyVersion >
4+ <AssemblyVersion >9 .0.0.0</AssemblyVersion >
55 <Description >https://github.com/BHoM/Python_Toolkit</Description >
66 <Version >6.0.0</Version >
77 <Authors >BHoM</Authors >
88 <Copyright >Copyright © https://github.com/BHoM</Copyright >
99 <RootNamespace >BH.Engine.Python</RootNamespace >
10- <FileVersion >8.3 .0.0</FileVersion >
10+ <FileVersion >9.0 .0.0</FileVersion >
1111 <OutputPath >..\Build\</OutputPath >
1212 </PropertyGroup >
1313 <ItemGroup >
3939 <Exec Command =" xcopy $(TargetDir)$(TargetFileName) $(ProgramData)\BHoM\Assemblies /Y" />
4040 </Target >
4141 <Target Name =" PreBuild" BeforeTargets =" PreBuildEvent" >
42- <Exec Command =" if not exist $(ProgramData)\BHoM\Extensions\PythonEnvironments mkdir $(ProgramData)\BHoM\Extensions\PythonEnvironments
 if not exist $(ProgramData)\BHoM\Extensions\PythonCode mkdir $(ProgramData)\BHoM\Extensions\PythonCode
 
 if exist $(ProgramData)\BHoM\Extensions\PythonCode\$(SolutionName) rmdir $(ProgramData)\BHoM\Extensions\PythonCode\$(SolutionName) /S /Q
 mkdir $(ProgramData)\BHoM\Extensions\PythonCode\$(SolutionName)
 
 robocopy $(ProjectDir)Python $(ProgramData)\BHoM\Extensions\PythonCode\$(SolutionName) /mir /xf " *.pyc" " *.ipynb" /xd " __*__" " .*" > output.log
 del output.log" />
42+ <Exec Command =" if not exist $(ProgramData)\BHoM\Extensions\PythonEnvironments mkdir $(ProgramData)\BHoM\Extensions\PythonEnvironments
 if not exist $(ProgramData)\BHoM\Extensions\PythonCode mkdir $(ProgramData)\BHoM\Extensions\PythonCode
 
 if exist $(ProgramData)\BHoM\Extensions\PythonCode\$(SolutionName) rmdir $(ProgramData)\BHoM\Extensions\PythonCode\$(SolutionName) /S /Q
 mkdir $(ProgramData)\BHoM\Extensions\PythonCode\$(SolutionName)
 
 robocopy $(ProjectDir)Python $(ProgramData)\BHoM\Extensions\PythonCode\$(SolutionName) /mir /xf " *.pyc" " *.ipynb" /xd " __*__" " .*" > output.log
 del output.log
 echo $(FileVersion) > $(ProgramData)\BHoM\Extensions\PythonCode\$(SolutionName)\VERSION.txt " />
4343 </Target >
4444</Project >
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <TargetFramework >netstandard2.0</TargetFramework >
5- <AssemblyVersion >8 .0.0.0</AssemblyVersion >
5+ <AssemblyVersion >9 .0.0.0</AssemblyVersion >
66 <Description >https://github.com/BHoM/Python_Toolkit</Description >
77 <Version >6.0.0</Version >
88 <Authors >BHoM</Authors >
99 <Copyright >Copyright © https://github.com/BHoM</Copyright >
1010 <RootNamespace >BH.oM.Python</RootNamespace >
11- <FileVersion >8.3 .0.0</FileVersion >
11+ <FileVersion >9.0 .0.0</FileVersion >
1212 <OutputPath >..\Build\</OutputPath >
1313 </PropertyGroup >
1414
You can’t perform that action at this time.
0 commit comments