Cole-Greer commented on code in PR #3547:
URL: https://github.com/apache/tinkerpop/pull/3547#discussion_r3640943370


##########
gremlin-python/pom.xml:
##########
@@ -82,6 +82,42 @@ limitations under the License.
                     </replacements>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.gmavenplus</groupId>
+                <artifactId>gmavenplus-plugin</artifactId>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.groovy</groupId>
+                        <artifactId>groovy-all</artifactId>
+                        <version>${groovy.version}</version>
+                        <type>pom</type>
+                        <scope>runtime</scope>
+                    </dependency>
+                </dependencies>
+                <executions>
+                    <execution>
+                        <id>update-version</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <scripts>
+                                <script>
+                                    def mavenVersion = "${project.version}"
+                                    // Translate Maven version to PEP 440:
+                                    //   "x.y.z-SNAPSHOT" -> "x.y.z.dev1"
+                                    //   "x.y.z"          -> "x.y.z"
+                                    def pythonVersion = 
mavenVersion.replace("-SNAPSHOT", ".dev1")
+                                    def platformAgnosticBaseDirPath = 
project.basedir.getAbsolutePath().replace("\\", "/")
+                                    def file = new 
File(platformAgnosticBaseDirPath + 
"/src/main/python/gremlin_python/__init__.py")
+                                    
file.write(file.getText("UTF-8").replaceFirst(/__version__ = '.*'/, 
"__version__ = '" + pythonVersion + "'"))

Review Comment:
   I added a comment to `__init__.py` indicating this is managed by maven and 
shouldn't be touched. Additionally I added a check to the replacement script 
such that it will crash the build if the regex match ever fails.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to