diff --git a/recipe/2626.patch b/recipe/2626.patch deleted file mode 100644 index 699744b..0000000 --- a/recipe/2626.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 9785e706229622626133c4b03c7abd004f62023f Mon Sep 17 00:00:00 2001 -From: Axel Huebl -Date: Sat, 4 Dec 2021 15:28:13 -0800 -Subject: [PATCH] Fix: Installed Symlink LIB - -The latest patch to these routines broke our library alias in installs. - -By default, this variable is relative and needs the prefix appended. -In some cases, e.g., if externally set, it can already be absolute. In that -case, we skip adding the prefix. ---- - CMakeLists.txt | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 04092ba962..a549546ab9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -343,9 +343,14 @@ if(WarpX_LIB) - else() - set(mod_ext "so") - endif() -+ if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR}) -+ set(ABS_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR}) -+ else() -+ set(ABS_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) -+ endif() - install(CODE "file(CREATE_LINK - $ -- ${CMAKE_INSTALL_LIBDIR}/libwarpx.${lib_suffix}.${mod_ext} -+ ${ABS_INSTALL_LIB_DIR}/libwarpx.${lib_suffix}.${mod_ext} - COPY_ON_ERROR SYMBOLIC)") - endif() - diff --git a/recipe/2726.patch b/recipe/2726.patch new file mode 100644 index 0000000..4a8e93e --- /dev/null +++ b/recipe/2726.patch @@ -0,0 +1,134 @@ +From 74ce023ec98a3e2c01a91e8c23fa58cd8ac5e4e3 Mon Sep 17 00:00:00 2001 +From: Axel Huebl +Date: Fri, 7 Jan 2022 06:28:12 -0800 +Subject: [PATCH] Python: Argv Encoding ASCII + +Since we pass those arguments to argc/argv in C in the end, we might +want to stay with ASCII. Otherwise, the interpretation might not fit +the local encoding. + +Alternatively, we can try encoding to `locale.getpreferredencoding()` +or setting the encoding forced to UTF-8. +--- + Python/pywarpx/_libwarpx.py | 32 ++++++++++++++++---------------- + 1 file changed, 16 insertions(+), 16 deletions(-) + +diff --git a/Python/pywarpx/_libwarpx.py b/Python/pywarpx/_libwarpx.py +index 9de8227397..925a276985 100755 +--- a/Python/pywarpx/_libwarpx.py ++++ b/Python/pywarpx/_libwarpx.py +@@ -392,14 +392,14 @@ def get_nattr_species(self, species_name): + + ''' + return self.libwarpx_so.warpx_nCompsSpecies( +- ctypes.c_char_p(species_name.encode('utf-8'))) ++ ctypes.c_char_p(species_name.encode('ascii'))) + + def amrex_init(self, argv, mpi_comm=None): + # --- Construct the ctype list of strings to pass in + argc = len(argv) + argvC = (_LP_c_char * (argc+1))() + for i, arg in enumerate(argv): +- enc_arg = arg.encode('utf-8') ++ enc_arg = arg.encode('ascii') + argvC[i] = ctypes.create_string_buffer(enc_arg) + + if mpi_comm is None or MPI is None: +@@ -620,7 +620,7 @@ def add_particles(self, species_name, x=None, y=None, z=None, ux=None, uy=None, + attr[:,self.get_particle_comp_index(species_name, key)-3] = vals + + self.libwarpx_so.warpx_addNParticles( +- ctypes.c_char_p(species_name.encode('utf-8')), x.size, ++ ctypes.c_char_p(species_name.encode('ascii')), x.size, + x, y, z, ux, uy, uz, nattr, attr, unique_particles + ) + +@@ -642,7 +642,7 @@ def get_particle_count(self, species_name): + + ''' + return self.libwarpx_so.warpx_getNumParticles( +- ctypes.c_char_p(species_name.encode('utf-8')) ++ ctypes.c_char_p(species_name.encode('ascii')) + ) + + def get_particle_structs(self, species_name, level): +@@ -670,7 +670,7 @@ def get_particle_structs(self, species_name, level): + particles_per_tile = _LP_c_int() + num_tiles = ctypes.c_int(0) + data = self.libwarpx_so.warpx_getParticleStructs( +- ctypes.c_char_p(species_name.encode('utf-8')), level, ++ ctypes.c_char_p(species_name.encode('ascii')), level, + ctypes.byref(num_tiles), ctypes.byref(particles_per_tile) + ) + +@@ -710,8 +710,8 @@ def get_particle_arrays(self, species_name, comp_name, level): + particles_per_tile = _LP_c_int() + num_tiles = ctypes.c_int(0) + data = self.libwarpx_so.warpx_getParticleArrays( +- ctypes.c_char_p(species_name.encode('utf-8')), +- ctypes.c_char_p(comp_name.encode('utf-8')), ++ ctypes.c_char_p(species_name.encode('ascii')), ++ ctypes.c_char_p(comp_name.encode('ascii')), + level, ctypes.byref(num_tiles), ctypes.byref(particles_per_tile) + ) + +@@ -883,8 +883,8 @@ def get_particle_comp_index(self, species_name, pid_name): + + ''' + return self.libwarpx_so.warpx_getParticleCompIndex( +- ctypes.c_char_p(species_name.encode('utf-8')), +- ctypes.c_char_p(pid_name.encode('utf-8')) ++ ctypes.c_char_p(species_name.encode('ascii')), ++ ctypes.c_char_p(pid_name.encode('ascii')) + ) + + def add_real_comp(self, species_name, pid_name, comm=True): +@@ -901,8 +901,8 @@ def add_real_comp(self, species_name, pid_name, comm=True): + + ''' + self.libwarpx_so.warpx_addRealComp( +- ctypes.c_char_p(species_name.encode('utf-8')), +- ctypes.c_char_p(pid_name.encode('utf-8')), comm ++ ctypes.c_char_p(species_name.encode('ascii')), ++ ctypes.c_char_p(pid_name.encode('ascii')), comm + ) + + def get_particle_boundary_buffer_size(self, species_name, boundary): +@@ -925,7 +925,7 @@ def get_particle_boundary_buffer_size(self, species_name, boundary): + + ''' + return self.libwarpx_so.warpx_getParticleBoundaryBufferSize( +- ctypes.c_char_p(species_name.encode('utf-8')), ++ ctypes.c_char_p(species_name.encode('ascii')), + self.get_boundary_number(boundary) + ) + +@@ -958,7 +958,7 @@ def get_particle_boundary_buffer_structs(self, species_name, boundary, level): + particles_per_tile = _LP_c_int() + num_tiles = ctypes.c_int(0) + data = self.libwarpx_so.warpx_getParticleBoundaryBufferStructs( +- ctypes.c_char_p(species_name.encode('utf-8')), ++ ctypes.c_char_p(species_name.encode('ascii')), + self.get_boundary_number(boundary), level, + ctypes.byref(num_tiles), ctypes.byref(particles_per_tile) + ) +@@ -1005,16 +1005,16 @@ def get_particle_boundary_buffer(self, species_name, boundary, comp_name, level) + num_tiles = ctypes.c_int(0) + if comp_name == 'step_scraped': + data = self.libwarpx_so.warpx_getParticleBoundaryBufferScrapedSteps( +- ctypes.c_char_p(species_name.encode('utf-8')), ++ ctypes.c_char_p(species_name.encode('ascii')), + self.get_boundary_number(boundary), level, + ctypes.byref(num_tiles), ctypes.byref(particles_per_tile) + ) + else: + data = self.libwarpx_so.warpx_getParticleBoundaryBuffer( +- ctypes.c_char_p(species_name.encode('utf-8')), ++ ctypes.c_char_p(species_name.encode('ascii')), + self.get_boundary_number(boundary), level, + ctypes.byref(num_tiles), ctypes.byref(particles_per_tile), +- ctypes.c_char_p(comp_name.encode('utf-8')) ++ ctypes.c_char_p(comp_name.encode('ascii')) + ) + + particle_data = [] diff --git a/recipe/meta.yaml b/recipe/meta.yaml index eefe71c..cdbb8f9 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -10,6 +10,10 @@ package: source: url: https://github.com/ECP-WarpX/WarpX/archive/{{ version }}.tar.gz sha256: {{ sha256 }} + patches: + # Fix encoding issues when passing inputs to AMReX + # https://github.com/ECP-WarpX/WarpX/pull/2726 + - 2726.patch build: number: {{ build }}