Gina Häußge
5304285f7b
♻️ pathvalidate is now always available
2022-02-01 17:06:09 +01:00
Gina Häußge
7fb9df9940
♻️ Migrate code base to Python 3 only
...
* pyupgrade
* various new codemods
* manual removal of Py2/3 compat imports
* manual adjustment of docs, examples, tests
* to_str is now the new to_unicode, deprecated
redirection to to_bytes has been removed
* to_native_str has been redirected to point to
to_str
* to_unicode has been redirected to point to
to_str
* atomic_write refactored to use
NamedTemporaryDirectory
* various other fixes/refactorings all over the
place
2022-02-01 12:57:01 +01:00
Gina Häußge
71fdbea090
💚 ACTUALLY fix the tests
...
Now that was embarrassing...
2022-01-26 13:48:42 +01:00
Gina Häußge
1582151a09
💚 Fix a py2 test failure
...
str.rstrip won't work when we receive unicode instead.
I'll celebrate the day I can finally kick py2
support from the source...
2022-01-26 13:38:38 +01:00
Gina Häußge
84a049bae7
♻️ Use centralized pip utils for SWU & PMGR
...
We don't want to reimplement already-installed-,
egg-problem- and other logic in multiple places,
so centralize this in octoprint.util.pip and
also add a test suite.
already-installed-logic has also been updated
to solve #4363 by now checking if there's been
a successful result line and if not if there's
been an "already satisfied" line, which should
work more universally across pip versions.
Closes #4363
2022-01-26 13:29:48 +01:00
Martijn Braam and Gina Häußge
8b3a51c1a0
⏪ Back to frozendict (#4244 )
...
The original frozendict module is maintained again and has not removed
setup.py from the repository to make packaging harder. Also the 2.x
releases have added native code to speed it up.
We need to however stick to older versions for
Python 2 and can only pull in newer versions
under Python 3.
Co-authored-by: Gina Häußge <gina@octoprint.org >
2021-11-10 12:49:14 +01:00
Gina Häußge
4c1d0338f4
✅ Add basic tests for fast_deepcopy
...
Should handle regular dict and something that's not
pickleable.
2021-09-15 18:17:42 +02:00
Gina Häußge
411b925506
🗑 Deprecate octoprint.util.bom_aware_open
...
The same can be achieved with io.open and a -sig encoding.
To be removed in 2.0
Closes #4228
2021-09-14 18:07:34 +02:00
Gina Häußge
70d07889e2
💚 emoji update changed wolf_face to wolf
2021-08-03 12:03:05 +02:00
Gina Häußge
9cf0802bf2
💚 Fix a typo in a unit test
2021-05-20 15:21:11 +02:00
Gina Häußge
f912adcd33
✨ Support unicode file names on Py3
...
If we are on py3 and thus can rely on pathvalidate, we'll now no longer
slugify uploaded files names, but try to keep them as close to the
original name as possible, including unicode and emoji and whatnot. This
requires the underlying file system to support this, so just in case the
old behaviour can be enforced by setting the config flag
feature.enforceReallyUniversalFilenames to true.
Closes #4078
2021-05-20 10:36:01 +02:00
Gina Häußge
3feb8deb8c
💚 Fix unit tests
...
Some day I'll learn to search in src AND tests...
2021-03-15 17:55:25 +01:00
Gina Häußge
f9745515e1
🎨 Add pyupgrade
2021-03-11 14:34:06 +01:00
Gina Häußge
97b6f25cfd
Merge branch 'pr/3916' into maintenance
2021-02-23 11:32:55 +01:00
Gina Häußge
fec2f9b83e
🐛 Further firmware line parser fixes
...
Something like _KEY should never get recognized as a key.
2021-02-23 11:32:36 +01:00
cp2004
bd3f7f8897
🎨 Make black happy again
2021-02-22 18:46:24 +00:00
cp2004
e43f4ddb50
💚 Add more tests for firmware info splitting
...
Part of #3916
2021-02-22 18:34:15 +00:00
Gina Häußge
55b08f6b5b
✨ backup: allow retore of backups from newer patch versions
...
E.g. backups from 1.6.3 can be applied on 1.6.2. However, 1.6.x still
won't be possible to restore under 1.5.x or earlier.
2021-02-17 14:05:40 +01:00
Gina Häußge
8427383b31
🐛 Don't touch BOM test files with pre-commit
2020-10-07 17:25:46 +02:00
Gina Häußge
b5be8f3eae
🎨 Add codemods to pre-commit, fix flake8
2020-10-07 16:27:11 +02:00
Gina Häußge
cae6730ea8
🎨 EOF/trailing whitespace/TOML&YAML check
...
And armed and documented pre-commit
2020-10-07 13:45:49 +02:00
Gina Häußge
fbfb34df58
🎨 Switch to use of isort
2020-10-07 13:15:52 +02:00
Gina Häußge
1f93b2355a
🎨 Switch to black formatting
2020-10-07 13:13:06 +02:00
Gina Häußge
b80826dd0c
Merge branch 'pr/3719' into maintenance
2020-09-14 12:44:02 +02:00
Tobias Frost
e83e2a4467
Hint mkstemp to create directory in the destination directory.
2020-09-07 15:10:50 +02:00
Gina Häußge
e49d0b0c22
💚 Use fixed umask for tests
2020-08-03 10:50:57 +02:00
Gina Häußge
e7e04271fd
💚 Fix tests broken by 894178918
2020-08-03 09:59:56 +02:00
Gina Häußge
010221ab5b
🐛 Fix handling of unset remote addresses
2020-01-29 11:35:56 +01:00
Gina Häußge
8df2a5436b
Merge branch 'maintenance' into devel
...
# Conflicts:
# setup.py
# src/octoprint/filemanager/__init__.py
# src/octoprint/plugins/action_command_prompt/static/js/action_command_prompt.js
# src/octoprint/plugins/forcelogin/__init__.py
# src/octoprint/plugins/forcelogin/templates/forcelogin_index.jinja2
# src/octoprint/plugins/pluginmanager/__init__.py
# src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
# src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js
# src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
# src/octoprint/plugins/tracking/__init__.py
# src/octoprint/printer/standard.py
# src/octoprint/server/views.py
# src/octoprint/static/js/app/viewmodels/printerstate.js
# src/octoprint/static/js/app/viewmodels/users.js
# src/octoprint/timelapse.py
# src/octoprint/users.py
# src/octoprint/util/comm.py
2019-09-12 09:30:28 +02:00
Gina Häußge
6069d74a54
💚 Fix unit tests
2019-06-18 13:35:21 +02:00
Gina Häußge
b03d43156d
🐛 Strip interface tags from addresses on local check
...
Closes #3143 and Sentry SERVER-11B
2019-05-15 13:19:14 +02:00
Gina Häußge
3654512085
🐛 Fix mysteriously broken unit tests
2019-02-13 16:42:21 +01:00
Gina Häußge
75b5fe198f
Merge branch 'maintenance' into devel
...
# Conflicts:
# AUTHORS.md
# src/octoprint/_version.py
# src/octoprint/plugins/backup/__init__.py
# src/octoprint/plugins/cura/__init__.py
# src/octoprint/plugins/cura/profile.py
# src/octoprint/plugins/cura/templates/cura_settings.jinja2
# src/octoprint/plugins/softwareupdate/scripts/update-octoprint.py
# src/octoprint/printer/standard.py
# src/octoprint/server/api/files.py
# src/octoprint/server/util/tornado.py
# src/octoprint/server/views.py
# src/octoprint/users.py
# src/octoprint/util/__init__.py
# versioneer.py
2019-02-13 14:28:06 +01:00
Gina Häußge
81d523b73d
♻ Backport to_str -> to_bytes from devel
...
Add unit tests.
2019-02-08 14:39:07 +01:00
Gina Häußge
32a8646135
♻ codecs.open -> io.open
...
The general consensus regarding codecs.open appears to be that it's only
left in Python 3 for backwards compatibility (which I find kind funny
but I digress...) and that io.open should be used instead for Py2.6+
since it's available and behaving the same in both versions. So that's
what we do here.
2019-02-06 16:05:09 +01:00
Gina Häußge
09cc7cf5f7
🐛 Fix unicode vs bytes issues for atomic_write
...
NamedTemporaryFile doesn't support the encoding parameter under py2.
However, without it specifying text mode defaults to ascii, causing some
issues especially with config files containing utf-8.
By swapping NamedTemporaryFile for mkstemp and a custom io.open call
(parameterized according to the open mode) we can support a proper
encoding aware atomic_write.
2019-02-06 16:03:32 +01:00
Gina Häußge
496e9f0ec4
✅ Add unit test for pip caller initialization
2019-02-06 13:11:03 +01:00
Matthias Urlichs
315ed57916
Another missing import
2019-02-04 21:12:20 +01:00
Matthias Urlichs
6bf8384c35
Kill of u"" (visual clutter)
2019-02-03 14:25:41 +01:00
Matthias Urlichs
1dacbc35bf
Use unicode_literals __future__
2019-02-03 14:09:57 +01:00
Matthias Urlichs
5d8535cb9c
Test string must be Unicode
2019-01-28 14:14:23 +01:00
Matthias Urlichs
008cde6ef6
octoprint.user => octoprint.access.user
2019-01-28 14:14:23 +01:00
Matthias Urlichs
f1673c148f
str vs utf
2019-01-28 14:14:23 +01:00
Matthias Urlichs
f3fdac7e5a
Use raw strings for all regexps.
...
No exceptions please.
2019-01-28 14:14:23 +01:00
Matthias Urlichs
f9916783e9
whitespace
2019-01-28 07:34:19 +01:00
Matthias Urlichs
c05b6572c5
Fix coding= headers
2019-01-27 17:36:16 +01:00
Matthias Urlichs
958fc7600d
Merge commit 'e0543de8ef5c1f67d4064e84a5e7ecacbdf1029e' into py23
2019-01-27 17:15:52 +01:00
Matthias Urlichs
f993f744ba
Merge commit 'c623e90ebc59b90b4f4cf582ab8185b2872acff4'; commit 'f416e96414f33fb31afdf4dfbf3c863e3db35543'; commit '9ecf39febe31a44e5f5db28249ebbf006ac1580c'; commit '582b03f21fe3d808bf4e11bbba90af54b6651b34'; commit 'f5c8b04958170f19f1806b1722bf5e857ded3dce'; commit '36818057a3b4769a77731f3be8bc661437db7132'; commit 'd987cb23c119132b287f70f1c979aac8c9fff7d2' into py23
2019-01-27 17:10:01 +01:00
MirceaDan
f243a52823
all files start now with same 2 lines
...
# coding=utf-8
from __future__ import absolute_import, division, print_function
2018-12-02 02:13:12 -08:00
MirceaDan
b6e49b59a7
unitest update to decode utf8
...
TypeError: write() argument 1 must be unicode, not str
2018-12-01 17:11:07 -08:00