Repository: OctoPrint/OctoPrint

Issue:
babel_extract doesn't work unless messages.pot already exists
#### What were you doing?

Running `python setup.py babel_extract` in my new plugin.



#### What did you expect to happen?

```
└──> octoprint dev plugin:new Test
plugin_package [octoprint_Test]: 
plugin_name [OctoPrint-Test]: 
repo_name [OctoPrint-Test]: 
full_name [You]: 
email [you@example.com]: 
github_username [you]: 
plugin_version [0.1.0]: 
plugin_description [TODO]: 
plugin_license [AGPLv3]: 
plugin_homepage [https://github.com/you/OctoPrint-Test]: 
plugin_source [https://github.com/you/OctoPrint-Test]: 
plugin_installurl [https://github.com/you/OctoPrint-Test/archive/master.zip]: 
└──> cd OctoPrint-Test 
└──> python setup.py babel_extract
Found packages: ['octoprint_Test']
running babel_extract
extracting messages from octoprint_Test/__init__.py
extracting messages from octoprint_Test/static/js/Test.js (extract_messages="gettext, ngettext")
writing PO template file to ./translations/messages.pot
```

#### What happened instead?

```
└──> octoprint dev plugin:new Test
plugin_package [octoprint_Test]: 
plugin_name [OctoPrint-Test]: 
repo_name [OctoPrint-Test]: 
full_name [You]: 
email [you@example.com]: 
github_username [you]: 
plugin_version [0.1.0]: 
plugin_description [TODO]: 
plugin_license [AGPLv3]: 
plugin_homepage [https://github.com/you/OctoPrint-Test]: 
plugin_source [https://github.com/you/OctoPrint-Test]: 
plugin_installurl [https://github.com/you/OctoPrint-Test/archive/master.zip]: 
└──> cd OctoPrint-Test 
└──> python setup.py babel_extract
Found packages: ['octoprint_Test']
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'babel_extract'
```

#### Did the same happen when running OctoPrint in safe mode?

I was not running the OctoPrint server.

#### Version of OctoPrint

git commit 1ccc1fa4

#### Operating System running OctoPrint

Linux

#### Printer model & used firmware incl. version

None

#### Browser and version of browser, operating system running browser

None

#### Link to octoprint.log

None

#### Link to contents of terminal tab or serial.log

None

#### Link to contents of Javascript console in the browser

None

#### Screenshot(s)/video(s) showing the problem:

Text above.

I have read the FAQ.


Discussion:

Resolving patch:
diff --git a/src/octoprint_setuptools/__init__.py b/src/octoprint_setuptools/__init__.py
--- a/src/octoprint_setuptools/__init__.py
+++ b/src/octoprint_setuptools/__init__.py
@@ -524,8 +524,7 @@ def create_plugin_setup_parameters(identifier="todo", name="TODO", version="0.1"
 	translation_dir = os.path.join(source_folder, "translations")
 	pot_file = os.path.join(translation_dir, "messages.pot")
 	bundled_dir = os.path.join(source_folder, package, "translations")
-	if os.path.isdir(translation_dir) and os.path.isfile(pot_file):
-		cmdclass.update(get_babel_commandclasses(pot_file=pot_file, output_dir=translation_dir, bundled_dir=bundled_dir, pack_name_prefix="{name}-i18n-".format(**locals()), pack_path_prefix="_plugins/{identifier}/".format(**locals())))
+	cmdclass.update(get_babel_commandclasses(pot_file=pot_file, output_dir=translation_dir, bundled_dir=bundled_dir, pack_name_prefix="{name}-i18n-".format(**locals()), pack_path_prefix="_plugins/{identifier}/".format(**locals())))
 
 	from setuptools import find_packages
 	packages = list(set([package] + filter(lambda x: x.startswith("{package}.".format(package=package)), find_packages(where=source_folder, exclude=ignored_packages)) + additional_packages))


Test patch: