diff --git a/README.rst b/README.rst index 8ab9b27..8247f4b 100644 --- a/README.rst +++ b/README.rst @@ -13,15 +13,15 @@ which is useful for IT shops that develop in both of these languages. Functionality ------------- -* keeps the *setup.py* version in sync with the Maven project version by updating setup.py in the **process-sources** phase -* packages the Python module during the Maven **package** phase -* allows specifying which format should the Python module be distributed as: source, RPM, egg, tar, zip, etc. +* Keeps the *setup.py* version in sync with the Maven project version by updating setup.py in the **process-sources** phase. +* Packages the Python module during the Maven **package** phase. +* Allows specifying which format should the Python module be distributed as: source, RPM, egg, tar, zip, etc. +* Supports uploading packages to PyPI during the **deploy** phase. Configuration ------------- -Add the following to your *pom.xml* build section: -:: +Add the following to your *pom.xml* build section:: maven-python-mojos @@ -43,6 +43,45 @@ Add the following to your *pom.xml* build section: +This defaults to building an egg file. If you would like to use another distribution type, you may specify something else:: + + + package + + package + + + rpm + + + +If you wish to build multiple different distribtion types, you can add multiple ```` blocks with different types. +Supported types are egg, wheel, wininst, rpm, bdist, dumb, source, or docs. + +If you wish to upload your packaged files to PyPI, add the following:: + + + deploy + + deploy + + + +This will default to uploading all of the packages generated by the **package** goal. If you don't want that, you can specify +a distribution type in the same way as you can for packaging. The deploy goal supports all distribution types except for docs. + +You can also optionally specify a repository to upload to:: + + + deploy + + deploy + + + https://pypi.myserver.com + + + setup.py -------- @@ -50,12 +89,13 @@ To make the code runnable outside maven you can have a setup.py. If a setup-temp your source root setup.py will be replaced. setup-template.py --------- +----------------- -setup template allows for using maven controlled variables in your setup.py file. +Setup template allows for using maven controlled variables in your setup.py file. Set the *version* field in your *setup-template.py* to a hardcoded constant of **${VERSION}**, e.g. Set the *name* field in your *setup-template.py* to a hardcoded constant of **${PROJECT_NAME}**, e.g. :: + from setuptools import setup, find_packages setup( @@ -65,13 +105,10 @@ Set the *name* field in your *setup-template.py* to a hardcoded constant of **${ packages = find_packages('.') ) - Maven Repository ---------------- -Add the following plugin repository to your *pom.xml* in order to use this plugin: - -:: +Add the following plugin repository to your *pom.xml* in order to use this plugin:: @@ -79,8 +116,3 @@ Add the following plugin repository to your *pom.xml* in order to use this plugi https://jitpack.io - - - - - diff --git a/src/main/java/com/github/mojos/distribute/AbstractSetupCommandMojo.java b/src/main/java/com/github/mojos/distribute/AbstractSetupCommandMojo.java index 612ad4c..c38669e 100644 --- a/src/main/java/com/github/mojos/distribute/AbstractSetupCommandMojo.java +++ b/src/main/java/com/github/mojos/distribute/AbstractSetupCommandMojo.java @@ -61,7 +61,7 @@ public abstract class AbstractSetupCommandMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException { final File buildDirectory = Paths.get(project.getBuild().getDirectory(), "maven-python").toFile(); - final String setupOutputCanonicalPath = project.getProperties().getProperty("python.distribute.plugin.setup.path"); + final String setupOutputCanonicalPath = project.getProperties().getProperty("python.distribute.plugin.setup.path", "src/main/python/setup.py"); try { List args = new ArrayList<>(); diff --git a/src/main/java/com/github/mojos/distribute/PackageMojo.java b/src/main/java/com/github/mojos/distribute/PackageMojo.java index fb160cb..710eb3b 100644 --- a/src/main/java/com/github/mojos/distribute/PackageMojo.java +++ b/src/main/java/com/github/mojos/distribute/PackageMojo.java @@ -39,6 +39,7 @@ static String getDistributionTypeArg(String distributionType) throws MojoExecuti case "wheel": case "wininst": case "rpm": + case "dumb": return "bdist_" + distributionType; case "bdist": return "bdist"; @@ -47,7 +48,7 @@ static String getDistributionTypeArg(String distributionType) throws MojoExecuti case "docs": return "build_sphinx"; default: - throw new MojoExecutionException("Invalid distributionType (egg, wheel, wininst, rpm, bdist, source, or docs supported): " + distributionType); + throw new MojoExecutionException("Invalid distributionType (egg, wheel, wininst, rpm, bdist, dumb, source, or docs supported): " + distributionType); } }