Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lidia Contreras Ochando
clowdflows
Commits
d615cf58
Commit
d615cf58
authored
Apr 01, 2015
by
Janez
Browse files
Merge branch 'external-packages' of /home/git/repositories/kt/mothra
parents
76cb82f4
72533e6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
workflows/management/commands/export_package.py
View file @
d615cf58
...
...
@@ -71,13 +71,18 @@ def serialize_category(c):
data
[
'fields'
].
pop
(
'user'
)
return
data
def
export_package
(
package_name
,
writer
):
def
export_package
(
package_name
,
writer
,
dest_folder
=
None
):
style
=
color_style
()
external
=
package_name
in
settings
.
INSTALLED_APPS_EXTERNAL_PACKAGES
if
external
and
not
dest_folder
:
raise
CommandError
(
"You must provide a destination folder when exporting external packages."
)
if
package_name
in
settings
.
INSTALLED_APPS_EXTERNAL_PACKAGES
:
raise
CommandError
(
"You can
not export extern
al packages."
)
if
not
external
and
dest_folder
:
raise
CommandError
(
"You can
't use a custom destination folder when exporting loc
al packages."
)
if
'workflows.'
+
package_name
not
in
settings
.
INSTALLED_APPS
:
if
'workflows.'
+
package_name
not
in
settings
.
INSTALLED_APPS
and
not
external
:
raise
CommandError
(
"Package not found in INSTALLED_APPS."
)
#here we check the integrity of the package
...
...
@@ -92,7 +97,10 @@ def export_package(package_name,writer):
#first we check if package_data directory exists and make it if it doesn't
package_directory
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'../../'
+
package_name
+
"/package_data/"
)
if
external
:
package_directory
=
dest_folder
else
:
package_directory
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'../../'
+
package_name
+
"/package_data/"
)
ensure_dir
(
package_directory
)
widgets_directory
=
os
.
path
.
join
(
package_directory
,
"widgets"
)
deprecated_widgets_directory
=
os
.
path
.
join
(
package_directory
,
"deprecated_widgets"
)
...
...
@@ -182,15 +190,19 @@ def export_package(package_name,writer):
class
Command
(
BaseCommand
):
args
=
'package_name'
args
=
'package_name
[external_destination_folder]
'
help
=
'Exports the package "package_name".'
def
handle
(
self
,
*
args
,
**
options
):
if
(
len
(
args
)
<
1
)
:
if
len
(
args
)
<
1
:
raise
CommandError
(
'Argument "package_name" is required.'
)
dest_folder
=
None
if
len
(
args
)
==
2
:
dest_folder
=
args
[
1
]
package_name
=
args
[
0
]
writer
=
self
.
stdout
export_package
(
package_name
,
writer
)
writer
.
write
(
'Thanks for using the new export command. You rock.
\n
'
)
\ No newline at end of file
export_package
(
package_name
,
writer
,
dest_folder
=
dest_folder
)
writer
.
write
(
'Thanks for using the new export command. You rock.
\n
'
)
workflows/management/commands/import_all.py
View file @
d615cf58
...
...
@@ -22,7 +22,6 @@ class Command(BaseCommand):
package_name
=
app
.
split
(
'workflows.'
)[
1
]
packages
.
append
(
package_name
)
elif
app
in
settings
.
INSTALLED_APPS_EXTERNAL_PACKAGES
:
print
app
extern_packages
.
append
(
app
)
for
package
in
packages
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment