You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marvin.apache.org by we...@apache.org on 2020/03/30 17:50:51 UTC

[incubator-marvin] branch develop updated (c61d463 -> bcf2522)

This is an automated email from the ASF dual-hosted git repository.

weichen pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-marvin.git.


    from c61d463  fix thrift-sasl to version 0.3.0
     add 29d7597  Marvin engine delete command
     new f8ef65d  get_dir_name and get_package name functions added
     new 35237f9  Delete virtualenv comment added
     new bcf2522  Merge branch 'pr/44' into develop

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../marvin_python_toolbox/management/engine.py     | 115 ++++++++++++++++-----
 1 file changed, 87 insertions(+), 28 deletions(-)


[incubator-marvin] 02/03: Delete virtualenv comment added

Posted by we...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

weichen pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-marvin.git

commit 35237f9f2a561439646096008cfff44a7d5f1f0b
Author: sette <br...@protonmail.com>
AuthorDate: Thu Mar 26 15:35:08 2020 -0300

    Delete virtualenv comment added
---
 python-toolbox/marvin_python_toolbox/management/engine.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/python-toolbox/marvin_python_toolbox/management/engine.py b/python-toolbox/marvin_python_toolbox/management/engine.py
index 9febeab..9dec2cc 100644
--- a/python-toolbox/marvin_python_toolbox/management/engine.py
+++ b/python-toolbox/marvin_python_toolbox/management/engine.py
@@ -371,7 +371,7 @@ def _get_package_name(package,type_):
     return package
 
 def _get_dir(name,package,type_):
-     # Process directory/virtualenv name
+    # Process directory/virtualenv name
 
     # Directory name should use '-' instead of '_'
     dir_ = package.replace('_', '-')
@@ -502,6 +502,7 @@ def delete(name,dest,package):
     # Get dest name
     dest = os.path.join(dest, dir_)
 
+    # Delete virtualenv 
     venv_name = _delete_virtual_env(dir_)
 
     try:


[incubator-marvin] 01/03: get_dir_name and get_package name functions added

Posted by we...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

weichen pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-marvin.git

commit f8ef65d9ab572e5abf6db3a0d868ae59b4a4570e
Author: sette <br...@protonmail.com>
AuthorDate: Mon Mar 9 16:02:11 2020 -0300

    get_dir_name and get_package name functions added
---
 .../marvin_python_toolbox/management/engine.py     | 109 +++++++++------------
 1 file changed, 49 insertions(+), 60 deletions(-)

diff --git a/python-toolbox/marvin_python_toolbox/management/engine.py b/python-toolbox/marvin_python_toolbox/management/engine.py
index e3135b6..9febeab 100644
--- a/python-toolbox/marvin_python_toolbox/management/engine.py
+++ b/python-toolbox/marvin_python_toolbox/management/engine.py
@@ -352,6 +352,40 @@ IGNORE_DIRS = [
 
 _orig_type = type
 
+def _get_package_name(package,type_):
+    # Make sure package name starts with "marvin"
+    if not package.startswith('marvin'):
+        package = 'marvin_{}'.format(package)
+
+    # Remove "lib" prefix from package name
+    if type_ == 'lib' and package.endswith('lib'):
+        package = package[:-3]
+    # Custom strip to remove underscores
+    package = package.strip('_')
+
+    # Append project type to services
+
+    if type_ in TEMPLATE_BASES and not package.endswith('engine'):
+        package = '{}_engine'.format(package)
+
+    return package
+
+def _get_dir(name,package,type_):
+     # Process directory/virtualenv name
+
+    # Directory name should use '-' instead of '_'
+    dir_ = package.replace('_', '-')
+
+    # Remove "marvin" prefix from directory
+    if dir_.startswith('marvin'):
+        dir_ = dir_[6:]
+    dir_ = dir_.strip('-')
+
+    # Append "lib" to directory name if creating a lib
+    if type_ == 'lib' and not dir_.endswith('lib'):
+        dir_ = '{}-lib'.format(dir_)
+    
+    return dir_
 
 @cli.command('engine-generateenv', help='Generate a new marvin engine environment and install default requirements.')
 @click.argument('engine-path', type=click.Path(exists=True))
@@ -388,36 +422,12 @@ def generate(name, description, mantainer, email, package, dest, no_env, no_git,
         
     # Process package name
     package = _slugify(package or name)
+    package = _get_package_name(package,type_)
 
-    # Make sure package name starts with "marvin"
-    if not package.startswith('marvin'):
-        package = 'marvin_{}'.format(package)
-
-    # Remove "lib" prefix from package name
-    if type_ == 'lib' and package.endswith('lib'):
-        package = package[:-3]
-    # Custom strip to remove underscores
-    package = package.strip('_')
-
-    # Append project type to services
-
-    if type_ in TEMPLATE_BASES and not package.endswith('engine'):
-        package = '{}_engine'.format(package)
-
-    # Process directory/virtualenv name
-
-    # Directory name should use '-' instead of '_'
-    dir_ = package.replace('_', '-')
-
-    # Remove "marvin" prefix from directory
-    if dir_.startswith('marvin'):
-        dir_ = dir_[6:]
-    dir_ = dir_.strip('-')
-
-    # Append "lib" to directory name if creating a lib
-    if type_ == 'lib' and not dir_.endswith('lib'):
-        dir_ = '{}-lib'.format(dir_)
+    # Process dir name
+    dir_ = _get_dir(name,package,type_)
 
+    # Get dest name
     dest = os.path.join(dest, dir_)
 
     if type_ not in TEMPLATE_BASES:
@@ -477,43 +487,22 @@ def generate(name, description, mantainer, email, package, dest, no_env, no_git,
 
 @cli.command('engine-delete', help='Delete an existing marvin engine project.')
 @click.option('--name', '-n', prompt='Project name', help='Project name')
+@click.option('--package', '-p', default='', help='Package name')
 @click.option('--dest', '-d', envvar='MARVIN_HOME', type=click.Path(exists=True), help='Root folder path for the creation')
-def delete_engine(name,dest):
+def delete(name,dest,package):
     type_ = 'python-engine'
+   
     # Process package name
-    package = _slugify(name)
-
-    # Make sure package name starts with "marvin"
-    if not package.startswith('marvin'):
-        package = 'marvin_{}'.format(package)
-
-    # Remove "lib" prefix from package name
-    if type_ == 'lib' and package.endswith('lib'):
-        package = package[:-3]
-    # Custom strip to remove underscores
-    package = package.strip('_')
-
-    # Append project type to services
-
-    if type_ in TEMPLATE_BASES and not package.endswith('engine'):
-        package = '{}_engine'.format(package)
-
-    # Process directory/virtualenv name
-
-    # Directory name should use '-' instead of '_'
-    dir_ = package.replace('_', '-')
-
-    # Remove "marvin" prefix from directory
-    if dir_.startswith('marvin'):
-        dir_ = dir_[6:]
-    dir_ = dir_.strip('-')
+    package = _slugify(package or name)
+    package = _get_package_name(package,type_)
 
-    # Append "lib" to directory name if creating a lib
-    if type_ == 'lib' and not dir_.endswith('lib'):
-        dir_ = '{}-lib'.format(dir_)
+    # Process dir name
+    dir_ = _get_dir(name,package,type_)
 
+    # Get dest name
     dest = os.path.join(dest, dir_)
-    venv_name = _delete_virtual_env(dir_, dest)
+
+    venv_name = _delete_virtual_env(dir_)
 
     try:
         shutil.rmtree(dest)
@@ -610,7 +599,7 @@ def _create_virtual_env(name, dest, python):
     return venv_name
 
 
-def _delete_virtual_env(name, dest):
+def _delete_virtual_env(name):
     venv_name = '{}-env'.format(name).replace('_', '-')
     print('Deleting virtualenv: {0}...'.format(venv_name))
 


[incubator-marvin] 03/03: Merge branch 'pr/44' into develop

Posted by we...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

weichen pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-marvin.git

commit bcf252229d12d52c8c5d29d0a0f4c1d961a9e86a
Merge: c61d463 35237f9
Author: Wei Chen <we...@apache.org>
AuthorDate: Tue Mar 31 01:49:34 2020 +0800

    Merge branch 'pr/44' into develop

 .../marvin_python_toolbox/management/engine.py     | 115 ++++++++++++++++-----
 1 file changed, 87 insertions(+), 28 deletions(-)