Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blopware
funkwhale
Commits
8116e733
Commit
8116e733
authored
5 years ago
by
Ciarán Ainsworth
Committed by
Agate
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix support for Python 3.5 in import script
parent
79753d77
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/funkwhale_api/music/management/commands/import_files.py
+20
-11
20 additions, 11 deletions
api/funkwhale_api/music/management/commands/import_files.py
changes/changelog.d/1147.bugfix
+1
-0
1 addition, 0 deletions
changes/changelog.d/1147.bugfix
with
21 additions
and
11 deletions
api/funkwhale_api/music/management/commands/import_files.py
+
20
−
11
View file @
8116e733
...
@@ -23,11 +23,7 @@ from funkwhale_api.common import utils as common_utils
...
@@ -23,11 +23,7 @@ from funkwhale_api.common import utils as common_utils
from
funkwhale_api.music
import
models
,
tasks
,
utils
from
funkwhale_api.music
import
models
,
tasks
,
utils
def
crawl_dir
(
dir
,
extensions
,
recursive
=
True
,
ignored
=
[]):
def
dir_scanner
(
scanner
,
extensions
,
recursive
,
ignored
):
if
os
.
path
.
isfile
(
dir
):
yield
dir
return
with
os
.
scandir
(
dir
)
as
scanner
:
for
entry
in
scanner
:
for
entry
in
scanner
:
if
entry
.
is_file
():
if
entry
.
is_file
():
for
e
in
extensions
:
for
e
in
extensions
:
...
@@ -35,11 +31,24 @@ def crawl_dir(dir, extensions, recursive=True, ignored=[]):
...
@@ -35,11 +31,24 @@ def crawl_dir(dir, extensions, recursive=True, ignored=[]):
if
entry
.
path
not
in
ignored
:
if
entry
.
path
not
in
ignored
:
yield
entry
.
path
yield
entry
.
path
elif
recursive
and
entry
.
is_dir
():
elif
recursive
and
entry
.
is_dir
():
yield
from
crawl_di
r
(
yield
from
dir_scanne
r
(
entry
,
extensions
,
recursive
=
recursive
,
ignored
=
ignored
entry
,
extensions
,
recursive
=
recursive
,
ignored
=
ignored
)
)
def
crawl_dir
(
dir
,
extensions
,
recursive
=
True
,
ignored
=
[]):
if
os
.
path
.
isfile
(
dir
):
yield
dir
return
else
:
try
:
scanner
=
os
.
scandir
(
dir
)
yield
from
dir_scanner
(
scanner
,
extensions
,
recursive
,
ignored
)
finally
:
if
hasattr
(
scanner
,
"
close
"
):
scanner
.
close
()
def
batch
(
iterable
,
n
=
1
):
def
batch
(
iterable
,
n
=
1
):
has_entries
=
True
has_entries
=
True
while
has_entries
:
while
has_entries
:
...
...
This diff is collapsed.
Click to expand it.
changes/changelog.d/1147.bugfix
0 → 100644
+
1
−
0
View file @
8116e733
Fixed an issue where in-place importing didn't work for directories on machines running Python 3.5 (#1148, #1147)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment