From b3ddbd77101ea2d133a292ab8be817a434be50ce Mon Sep 17 00:00:00 2001 From: Peter Pan Date: Tue, 10 Mar 2020 20:14:27 +0800 Subject: [PATCH] fix: update python setup (#583) * v2.0.0-beta.12 * v2.0.0-beta.13 * fix: use new development server * v2.0.0-beta.14 * build: build frontend from npm tarball * fix: update python setup --- setup.py | 9 ++++++++- visualdl/server/lib.py | 14 +++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index b40dcec6..d1259ce6 100644 --- a/setup.py +++ b/setup.py @@ -109,6 +109,13 @@ scripts = ['visualdl/server/visualdl', 'demo/vdl_create_scratch_log'] if platform == 'win32': scripts.append('visualdl/server/visualDL.bat') +def frontend_package_files(directory): + paths = [] + for (path, directories, filenames) in os.walk(directory): + for filename in filenames: + paths.append(os.path.join(path, filename)) + return paths + setup( name="visualdl", version=VERSION_NUMBER, @@ -120,7 +127,7 @@ setup( install_requires=install_requires, package_data={ 'visualdl.server': - ['dist/*.js', 'dist/*.html', 'dist/fonts/*', 'dist/assets/*'], + [s[len('visualdl/server/'):] for s in frontend_package_files('visualdl/server/dist')], 'visualdl': libraries, 'visualdl.python': diff --git a/visualdl/server/lib.py b/visualdl/server/lib.py index bfd3d66b..ab054d05 100644 --- a/visualdl/server/lib.py +++ b/visualdl/server/lib.py @@ -89,17 +89,13 @@ def get_image_tags(storage): with storage.mode(mode) as reader: tags = reader.tags('image') if tags: - result[mode] = {} + result[mode] = [] for tag in tags: image = reader.image(tag) for i in range(max(1, image.num_samples())): caption = tag if image.num_samples( ) <= 1 else '%s/%d' % (tag, i) - result[mode][caption] = { - 'displayName': caption, - 'description': "", - 'samples': 1, - } + result[mode].append(caption) return result @@ -179,11 +175,7 @@ def get_audio_tags(storage): for i in range(max(1, audio.num_samples())): caption = tag if audio.num_samples( ) <= 1 else '%s/%d' % (tag, i) - result[mode][caption] = { - 'displayName': caption, - 'description': "", - 'samples': 1, - } + result[mode].append(caption) return result -- GitLab