Skip to content
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

[Refactoring... WIP] Implement CPython-compatible gzip.decompress, restore uzlib. Enable both for atmel-samd #1274

Closed
wants to merge 3 commits into from
Closed
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
17 changes: 17 additions & 0 deletions docs/library/gzip.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:mod:`gzip` -- gzip file decompression
============================================

.. module:: gzip
:synopsis: gzip file decompression

|see_cpython_module| :mod:`cpython:gzip`.

This module enables decompression of gzip (``.gz``) files, a common format for
compressing large data (for example, CSV or TXT files).

Functions
---------

.. function:: decompress(data)

Decompress the data, returning a bytes object containing the uncompressed data.
7 changes: 4 additions & 3 deletions docs/library/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ standard Python library.
You may need to change your code later if you rely
on any non-standard functionality they currently provide.

CircuitPython's goal long-term goalis that code written in CircuitPython
CircuitPython's goal long-term goal is that code written in CircuitPython
using Python standard libraries will be runnable on CPython without changes.

Some libraries below are not enabled on CircuitPython builds with
limited flash memory, usually on non-Express builds:
``uerrno``, ``ure``.
``uerrno``, ``ure``, ``uzlib``.

Some libraries are not currently enabled in any CircuitPython build, but may be in the future:
``uio``, ``ujson``, ``uzlib``.
``uio``, ``ujson``

Some libraries are only enabled only WiFi-capable ports (ESP8266, nRF)
because they are typically used for network software:
Expand All @@ -45,6 +45,7 @@ Not all of these are enabled on all WiFi-capable ports.
binascii.rst
collections.rst
gc.rst
gzip.rst
hashlib.rst
sys.rst
uerrno.rst
Expand Down
4 changes: 2 additions & 2 deletions locale/ID.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-05 17:52-0700\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -1342,7 +1342,7 @@ msgstr ""
msgid "__new__ arg must be a user-type"
msgstr ""

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr "sebuah objek menyerupai byte (bytes-like) dibutuhkan"

Expand Down
4 changes: 2 additions & 2 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-05 17:52-0700\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -1309,7 +1309,7 @@ msgstr ""
msgid "__new__ arg must be a user-type"
msgstr ""

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions locale/de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-05 17:52-0700\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
Expand Down Expand Up @@ -1349,7 +1349,7 @@ msgstr "__init__() sollte None zurückgeben, nicht '%s'"
msgid "__new__ arg must be a user-type"
msgstr "__new__ arg muss user-type sein"

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr "ein Byte-ähnliches Objekt ist erforderlich"

Expand Down
4 changes: 2 additions & 2 deletions locale/en_US.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-05 17:52-0700\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -1309,7 +1309,7 @@ msgstr ""
msgid "__new__ arg must be a user-type"
msgstr ""

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions locale/en_x_pirate.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-05 17:52-0700\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
Expand Down Expand Up @@ -1313,7 +1313,7 @@ msgstr ""
msgid "__new__ arg must be a user-type"
msgstr ""

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions locale/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -1358,7 +1358,7 @@ msgstr "__init__() deberia devolver None, no '%s'"
msgid "__new__ arg must be a user-type"
msgstr "__new__ arg debe ser un user-type"

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr "se requiere un objeto bytes-like"

Expand Down
4 changes: 2 additions & 2 deletions locale/fil.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
Expand Down Expand Up @@ -1362,7 +1362,7 @@ msgstr "__init__() dapat magbalink na None, hindi '%s'"
msgid "__new__ arg must be a user-type"
msgstr "__new__ arg ay dapat na user-type"

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr "a bytes-like object ay kailangan"

Expand Down
4 changes: 2 additions & 2 deletions locale/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
Expand Down Expand Up @@ -1387,7 +1387,7 @@ msgstr "__init__() doit retourner None, pas '%s'"
msgid "__new__ arg must be a user-type"
msgstr "l'argument __new__ doit être d'un type défini par l'utilisateur"

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr "un objet 'bytes-like' est requis"

Expand Down
4 changes: 2 additions & 2 deletions locale/it_IT.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -1356,7 +1356,7 @@ msgstr "__init__() deve ritornare None, non '%s'"
msgid "__new__ arg must be a user-type"
msgstr ""

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr "un oggetto byte-like è richiesto"

Expand Down
4 changes: 2 additions & 2 deletions locale/pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-05 17:52-0700\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
Expand Down Expand Up @@ -1333,7 +1333,7 @@ msgstr "__init__() powinien zwracać None, nie '%s'"
msgid "__new__ arg must be a user-type"
msgstr "Argument __new__ musi być typu użytkownika"

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr "wymagany obiekt typu bytes"

Expand Down
4 changes: 2 additions & 2 deletions locale/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -1330,7 +1330,7 @@ msgstr ""
msgid "__new__ arg must be a user-type"
msgstr ""

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions locale/zh_Latn_pinyin.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-05 17:52-0700\n"
"POT-Creation-Date: 2019-08-11 15:16-0700\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
Expand Down Expand Up @@ -1343,7 +1343,7 @@ msgstr "__Init__() yīnggāi fǎnhuí not, ér bùshì '%s'"
msgid "__new__ arg must be a user-type"
msgstr "__new__ cānshù bìxū shì yònghù lèixíng"

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c extmod/moduzlib.c
msgid "a bytes-like object is required"
msgstr "xūyào yīgè zì jié lèi duìxiàng"

Expand Down
4 changes: 4 additions & 0 deletions ports/atmel-samd/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#define MICROPY_PY_IO (0)
#define MICROPY_PY_UJSON (0)
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
#define MICROPY_PY_UZLIB (0)
#define MICROPY_PY_GZIP (0)
#define MICROPY_PY_UERRNO_LIST \
X(EPERM) \
X(ENOENT) \
Expand All @@ -68,6 +70,8 @@
#define MICROPY_PY_IO (1)
#define MICROPY_PY_UJSON (1)
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
#define MICROPY_PY_UZLIB (1)
#define MICROPY_PY_GZIP (1)
// MICROPY_PY_UERRNO_LIST - Use the default
#endif

Expand Down
1 change: 1 addition & 0 deletions py/builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ extern const mp_obj_dict_t mp_module_builtins_globals;
extern const mp_obj_module_t mp_module_uerrno;
extern const mp_obj_module_t mp_module_uctypes;
extern const mp_obj_module_t mp_module_uzlib;
extern const mp_obj_module_t mp_module_gzip;
extern const mp_obj_module_t mp_module_ujson;
extern const mp_obj_module_t mp_module_ure;
extern const mp_obj_module_t mp_module_uheapq;
Expand Down
2 changes: 2 additions & 0 deletions py/circuitpy_defns.mk
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ $(filter $(SRC_PATTERNS), \
displayio/ParallelBus.c \
frequencyio/__init__.c \
frequencyio/FrequencyIn.c \
gzip/__init__c. \
i2cslave/I2CSlave.c \
i2cslave/__init__.c \
microcontroller/Pin.c \
Expand All @@ -274,6 +275,7 @@ $(filter $(SRC_PATTERNS), \
time/__init__.c \
touchio/TouchIn.c \
touchio/__init__.c \
zlib/__init__.c \
)

# These don't have corresponding files in each port but are still located in
Expand Down
8 changes: 8 additions & 0 deletions py/mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,14 @@ typedef double mp_float_t;
#define MICROPY_PY_UZLIB (0)
#endif

#ifndef MICROPY_PY_GZIP
#define MICROPY_PY_GZIP (0)
#endif

#if MICROPY_PY_GZIP && !MICROPY_PY_UZLIB
#error gzip depends on uzlib support
#endif

#ifndef MICROPY_PY_UJSON
#define MICROPY_PY_UJSON (0)
#endif
Expand Down
3 changes: 0 additions & 3 deletions py/objmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
#if MICROPY_PY_UCTYPES
{ MP_ROM_QSTR(MP_QSTR_uctypes), MP_ROM_PTR(&mp_module_uctypes) },
#endif
#if MICROPY_PY_UZLIB
{ MP_ROM_QSTR(MP_QSTR_uzlib), MP_ROM_PTR(&mp_module_uzlib) },
#endif
#if MICROPY_PY_UJSON
#if CIRCUITPY
// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here.
Expand Down
1 change: 0 additions & 1 deletion py/py.mk
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ PY_EXTMOD_O_BASENAME = \
extmod/moductypes.o \
extmod/modujson.o \
extmod/modure.o \
extmod/moduzlib.o \
extmod/moduheapq.o \
extmod/modutimeq.o \
extmod/moduhashlib.o \
Expand Down
Loading