xiazcy commented on code in PR #3547:
URL: https://github.com/apache/tinkerpop/pull/3547#discussion_r3640853386
##########
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:
Nit: this regex may fail silently if the `__init__.py`'s format gets changed
(spacing, quotes, etc.), though I don't see a reason it would, so not a big
concern, just a note here.
--
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]