marvin: Fix marvin.sync profile, fixes regression from e10f8e8

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Leo Simons 2014-08-13 11:15:41 +02:00 committed by Rohit Yadav
parent 701b7a2d0e
commit 2279289465
3 changed files with 61 additions and 10 deletions

54
tools/marvin/mvn-setup.py Executable file
View File

@ -0,0 +1,54 @@
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# wrapper around setup.py which injects the version number provided as a
# command line argument called from maven (see pom.xml)
import sys
import re
import subprocess
import os.path
basedir = os.path.dirname(__file__)
setupScript = os.path.join(basedir, 'setup.py')
def replaceVersion(fname, version):
"""replace VERSION in setup.py"""
with open(fname, 'r') as f:
content = f.read()
needle = '\nVERSION\s*=\s*[\'"][^\'"]*[\'"]'
replacement = '\nVERSION = "%s"' % version
content = re.sub(needle, replacement, content, 1)
with open(fname, 'w') as f:
f.write(content)
def runSetupScript(args):
"""Invoke setup.py with the provided arguments"""
cmd = ['python', setupScript] + args
exitCode = subprocess.call(cmd)
return exitCode
if __name__ == "__main__":
version = sys.argv[1]
remainingArgs = sys.argv[2:]
replaceVersion(setupScript, version)
runSetupScript(remainingArgs)

View File

@ -72,7 +72,8 @@
<workingDirectory>${exec.workingdir}</workingDirectory>
<executable>python</executable>
<arguments>
<argument>setup.py</argument>
<argument>mvn-setup.py</argument>
<argument>${project.version}</argument>
<argument>sdist</argument>
</arguments>
</configuration>
@ -125,7 +126,8 @@
<workingDirectory>${exec.workingdir}</workingDirectory>
<executable>python</executable>
<arguments>
<argument>setup.py</argument>
<argument>mvn-setup.py</argument>
<argument>${project.version}</argument>
<argument>sdist</argument>
</arguments>
</configuration>
@ -141,8 +143,9 @@
<executable>pip</executable>
<arguments>
<argument>install</argument>
<argument>--allow-external</argument>
<argument>--upgrade</argument>
<argument>Marvin-0.1.0.tar.gz</argument>
<argument>Marvin-${project.version}.tar.gz</argument>
</arguments>
</configuration>
</execution>

View File

@ -27,13 +27,7 @@ except ImportError:
raise RuntimeError("python setuptools is required to build Marvin")
VERSION = '4.5.0'
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read().strip()
VERSION = "4.5.0-SNAPSHOT"
setup(name="Marvin",
version=VERSION,