diff --git a/python/src/META-INF/python-core-common.xml b/python/src/META-INF/python-core-common.xml index 79d52b9c9389..af14df447c12 100644 --- a/python/src/META-INF/python-core-common.xml +++ b/python/src/META-INF/python-core-common.xml @@ -615,6 +615,8 @@ + + diff --git a/python/src/com/jetbrains/python/packaging/setupPy/PyCreateSetupPyFromTemplateHandler.kt b/python/src/com/jetbrains/python/packaging/setupPy/PyCreateSetupPyFromTemplateHandler.kt new file mode 100644 index 000000000000..13edb770944d --- /dev/null +++ b/python/src/com/jetbrains/python/packaging/setupPy/PyCreateSetupPyFromTemplateHandler.kt @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jetbrains.python.packaging.setupPy + +import com.intellij.ide.fileTemplates.DefaultCreateFromTemplateHandler +import com.intellij.ide.fileTemplates.FileTemplate +import com.intellij.ide.fileTemplates.FileTemplateManager +import com.intellij.openapi.util.text.StringUtil + +class PyCreateSetupPyFromTemplateHandler : DefaultCreateFromTemplateHandler() { + + override fun handlesTemplate(template: FileTemplate?): Boolean { + return template == FileTemplateManager.getDefaultInstance().getInternalTemplate("Setup Script") + } + + override fun prepareProperties(props: MutableMap?) { + if (props != null) { + val description = props["Description"] + if (description is String) { + props["Description"] = StringUtil.escapeChar(description, '\'') + } + } + } +} \ No newline at end of file