Skip to content

Commit

Permalink
Bump rebound/reboundx to version 4.4.3/4.3.0 (pyodide#5163)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannorein authored Nov 7, 2024
1 parent 24dfc07 commit 651b690
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 19 deletions.
2 changes: 2 additions & 0 deletions docs/project/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ myst:

### Packages

- Upgraded `rebound` to 4.4.3 {pr}`5163`
- Upgraded `reboundx` to 4.3.0 {pr}`5163`
- Upgraded `msprime` to 1.3.3 {pr}`5159`
- Upgraded `tskit` to 0.6.0 {pr}`5157`
- Upgraded `pydantic_core` to 2.25.1 {pr}`5151`
Expand Down
8 changes: 5 additions & 3 deletions packages/rebound/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: rebound
version: 3.24.2
version: 4.4.3
top-level:
- rebound
build:
Expand All @@ -12,10 +12,12 @@ build:
cp librebound.cpython-*.so $WASM_LIBRARY_DIR/lib/
source:
url: https://files.pythonhosted.org/packages/5c/66/7564ac591bb088d7f35a59d560b5c26426bb8ef5415522232819fe11c45a/rebound-3.24.2.tar.gz
sha256: a3c5d4c6a10b9c1538e1051edcd6341ef3d13142b698ee9c4a1f112d9684d803
url: https://files.pythonhosted.org/packages/9d/f5/93f5abaf2c796e35b775e6fd395c2fd3729c17701fcb90fb4ed052fdd465/rebound-4.4.3.tar.gz
sha256: 8dd2fc69f4db4609abeb50048583d0428c716cd3eab11df868358f5384d826cf
patches:
- patches/0001-fix-install_name.patch
- patches/0002-fix-output.patch
- patches/0003-no-emscripten.patch

requirements:
run:
Expand Down
38 changes: 25 additions & 13 deletions packages/rebound/patches/0001-fix-install_name.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
Index: rebound-3.24.2/setup.py
===================================================================
--- rebound-3.24.2.orig/setup.py
+++ rebound-3.24.2/setup.py
@@ -23,8 +23,8 @@ extra_link_args=[]
From 0a6cc79e6814d7e2dbc637541cad86cebc47f855 Mon Sep 17 00:00:00 2001
From: Hanno Rein <[email protected]>
Date: Wed, 6 Nov 2024 17:37:22 -0500
Subject: [PATCH 3/3] install_name

---
setup.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index 6443cb27..965b2fc9 100644
--- a/setup.py
+++ b/setup.py
@@ -23,8 +23,8 @@ except:
extra_link_args=[]
if sys.platform == 'darwin':
from distutils import sysconfig
vars = sysconfig.get_config_vars()
- vars['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '-shared')
config_vars = sysconfig.get_config_vars()
- config_vars['LDSHARED'] = config_vars['LDSHARED'].replace('-bundle', '-shared')
- extra_link_args=['-Wl,-install_name,@rpath/librebound'+suffix]
+ # vars['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '-shared')
+ # extra_link_args=['-Wl,-install_name,@rpath/librebound'+suffix]

libreboundmodule = Extension('librebound',
sources = [ 'src/rebound.c',
+ #config_vars['LDSHARED'] = config_vars['LDSHARED'].replace('-bundle', '-shared')
+ #extra_link_args=['-Wl,-install_name,@rpath/librebound'+suffix]
if sys.platform == 'win32':
extra_compile_args=[ghash_arg, '-DLIBREBOUND', '-D_GNU_SOURCE', '-DSERVER']
else:
--
2.39.5 (Apple Git-154)

57 changes: 57 additions & 0 deletions packages/rebound/patches/0002-fix-output.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From f875c41a58ae4b3d59d97a5787ec3e546c737860 Mon Sep 17 00:00:00 2001
From: Hanno Rein <[email protected]>
Date: Wed, 6 Nov 2024 17:21:47 -0500
Subject: [PATCH] output

---
src/output.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/output.c b/src/output.c
index e897743a..fdd4ea45 100644
--- a/src/output.c
+++ b/src/output.c
@@ -349,7 +349,7 @@ void reb_simulation_output_timing(struct reb_simulation* r, const double tmax){
r->output_timing_last = temp;
}else{
#ifdef __EMSCRIPTEN__
- reb_remove_last_line();
+ // reb_remove_last_line();
#else
printf("\r");
#endif
--- a/src/output.c
+++ b/src/output.c
@@ -257,17 +257,17 @@ void profiling_stop(int cat){

#ifdef __EMSCRIPTEN__
// fflush does not work in emscripten. Workaround.
-EM_JS(void, reb_remove_last_line, (), {
- var output = document.getElementById("output");
- if (output){
- const lastIndex1 = output.value.lastIndexOf("\n");
- const lastIndex2 = output.value.lastIndexOf("\n",lastIndex1-1);
- const lastIndexNtot = output.value.lastIndexOf("N_tot=");
- if(lastIndex1>0 && lastIndex2<lastIndexNtot){
- output.value = output.value.substring(0, lastIndex2+1);
- }
- }
-});
+//EM_JS(void, reb_remove_last_line, (), {
+// var output = document.getElementById("output");
+// if (output){
+// const lastIndex1 = output.value.lastIndexOf("\n");
+// const lastIndex2 = output.value.lastIndexOf("\n",lastIndex1-1);
+// const lastIndexNtot = output.value.lastIndexOf("N_tot=");
+// if(lastIndex1>0 && lastIndex2<lastIndexNtot){
+// output.value = output.value.substring(0, lastIndex2+1);
+// }
+// }
+//});
#endif

int reb_simulation_output_screenshot(struct reb_simulation* r, const char* filename){
--
--
2.39.5 (Apple Git-154)

49 changes: 49 additions & 0 deletions packages/rebound/patches/0003-no-emscripten.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
From 90723d5083293ec9ced4085d1b6b8c8a68772fba Mon Sep 17 00:00:00 2001
From: Hanno Rein <[email protected]>
Date: Thu, 7 Nov 2024 09:40:09 -0500
Subject: [PATCH 4/4] no emscripten

---
src/rebound.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/rebound.c b/src/rebound.c
index 82f6ac60..accea978 100644
--- a/src/rebound.c
+++ b/src/rebound.c
@@ -665,7 +665,7 @@ int reb_check_exit(struct reb_simulation* const r, const double tmax, double* la
while(r->status == REB_STATUS_PAUSED || r->status == REB_STATUS_SCREENSHOT){
// Wait for user to disable paused simulation
#ifdef __EMSCRIPTEN__
- emscripten_sleep(100);
+ // emscripten_sleep(100);
#else
usleep(1000);
#endif
@@ -820,16 +820,16 @@ static void* reb_simulation_integrate_raw(void* args){
}
reb_run_heartbeat(r);
#ifdef __EMSCRIPTEN__
- double t0 = emscripten_performance_now();
+// double t0 = emscripten_performance_now();
#endif
while(reb_check_exit(r,thread_info->tmax,&last_full_dt)<0){
#ifdef __EMSCRIPTEN__
- double t1 = emscripten_performance_now();
- if (t1-t0>1000./120.){ // max framerate 120Hz
- t0 = t1;
- emscripten_sleep(0); // allow drawing and event handling
- }
-
+// double t1 = emscripten_performance_now();
+// if (t1-t0>1000./120.){ // max framerate 120Hz
+// t0 = t1;
+// emscripten_sleep(0); // allow drawing and event handling
+// }
+//
#endif
#ifdef OPENGL
if (r->display_data){
--
2.39.5 (Apple Git-154)

6 changes: 3 additions & 3 deletions packages/reboundx/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: reboundx
version: 3.10.1
version: 4.3.0
top-level:
- reboundx
build:
Expand All @@ -10,8 +10,8 @@ build:
ldflags: |
-L$(WASM_LIBRARY_DIR)/lib/
source:
url: https://files.pythonhosted.org/packages/14/08/c1c0b83c90ea43ea8e218beadb13332259e930a2ca62f85024be89d811f3/reboundx-3.10.1.tar.gz
sha256: 65b2fcecf296661aad15a81a8d7d7b7b96cc2ba834c89e49dba24445f146d642
url: https://files.pythonhosted.org/packages/2c/c2/32bb671c3f6944755b90c75d20f387daf4b9fc1e6919264cb0e9e26af8d7/reboundx-4.3.0.tar.gz
sha256: 94fc5b0993b623faa9964800f87fbc97236f7f12cb639c659d25702f1e0ac0ec
requirements:
run:
- rebound
Expand Down

0 comments on commit 651b690

Please sign in to comment.