Skip to content

Commit 0d23f81

Browse files
authored
Merge pull request #1429 from compas-dev/envname-cpython
Fix Info component
2 parents 6189b0a + f8c6888 commit 0d23f81

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
* Changed `requirements.txt` to allow `numpy>=2`.
2323
* Fixed bug in `compas.geometry.Polygon.points` setter by removing duplicate points if they exist.
2424
* Fixed bug in `compas.geometry.Polygon.plane` by aligning the normal of the bestfit plane with the approximate normal of the polygon faces.
25-
* Changed the order of face vertices in `compas.geometry.Surface.to_vertices_and_faces` to a counter clockwise cycling direction and outward facing normals for curved surfaces.>>>>>>> main
25+
* Changed the order of face vertices in `compas.geometry.Surface.to_vertices_and_faces` to a counter clockwise cycling direction and outward facing normals for curved surfaces.
2626
* Deprecated the `-v8.0` flag in `compas_rhino.install`. Install to Rhino8 by following: https://compas.dev/compas/latest/userguide/cad.rhino8.html.
27+
* Fixed `Info` Grasshopper component for cpython to handle non-bootstrapped environments.
2728

2829
### Removed
2930

src/compas_ghpython/components_cpython/Compas_Info/code.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33
Displays information about the active COMPAS environment.
44
"""
55

6-
import compas_bootstrapper
76
import Grasshopper
87

8+
import os
99
import compas
1010

1111

1212
class CompasInfo(Grasshopper.Kernel.GH_ScriptInstance):
1313
def RunScript(self):
14+
try:
15+
import compas_bootstrapper
16+
17+
environment_name = compas_bootstrapper.ENVIRONMENT_NAME
18+
except ImportError:
19+
environment_name = os.path.dirname(compas.__file__)
20+
environment_name = os.path.abspath(os.path.join(environment_name, ".."))
21+
1422
ghenv.Component.Message = "COMPAS v{}".format(compas.__version__) # noqa: F821
1523
info = "COMPAS Version: {}\nEnvironment: {}"
16-
return info.format(compas.__version__, compas_bootstrapper.ENVIRONMENT_NAME)
24+
return info.format(compas.__version__, environment_name)

0 commit comments

Comments
 (0)