Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build bdist_wheel, use twine for upload #21

Merged
merged 2 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ The following dependencies need to be installed before being able to run the `ro
* Install up-to-date setuptools via PIP (if necessary):
* `pip3 install --upgrade setuptools`
* See https://packaging.python.org/guides/tool-recommendations/#publishing-platform-migration for more information why that is necessary.
* Install stdeb (0.8.4 or higher) via PIP:
* Install `stdeb` (0.8.4 or higher) via PIP:
* `sudo pip install [--upgrade] stdeb`
* `sudo pip3 install [--upgrade] stdeb`
* Do **not** use the Debian packages on Wily and newer.
They will embed a newer Python dependency into the control file (2.7.5, 3.3.2) which breaks the package on older distributions like *Precise*.
* Install `twine` via PIP:
* `sudo pip3 install [--upgrade] twine`

Note: Make sure `pip` is for Python2, because sometimes when you install pip for Python3 (like on precise) it overwrites `pip` as pip for Python3. You can explicitly invoke pip from Python2 like this:

Expand Down
25 changes: 10 additions & 15 deletions scripts/ros_release_python
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,19 @@ def get_name_and_version():
def release_to_pip(name, version, upload):
_print_section('Release Python package to PIP')

cmd = ['python3', 'setup.py', 'sdist']
upload_targets = ['upload']
msgs = ['Building sdist package']
if upload:
cmd.extend(upload_targets)
msgs.append('upload package to PIP')
_print_subsection('%s...' % ', '.join(msgs))
if upload:
print('# ' + ' '.join(cmd))
else:
print('# ' + ' '.join(cmd) + ' # ' + ' '.join(upload_targets))
_print_subsection('Building sdist and bdist_wheel packages...')
cmd = ['python3', 'setup.py', 'sdist', 'bdist_wheel']
print('# ' + ' '.join(cmd))
subprocess.check_call(cmd)

tarball = 'dist/%s-%s.tar.gz' % (name, version)
assert os.path.exists(tarball), "Failed to generate source tarball '%s'" % tarball
upload_cmd = ['scp', tarball, '[email protected]:/home/ros/data/download.ros.org/downloads/%s' % name]

upload_cmd = ['twine', 'upload', '-s', 'dist/*']
if upload:
_print_subsection('Uploading package to download server...')
_print_subsection('Uploading package to PIP...')
else:
_print_subsection('Skip uploading package to download server')
_print_subsection('Skip uploading package to PIP')
print('# ' + ' '.join(upload_cmd))
if upload:
subprocess.check_call(upload_cmd)
Expand Down Expand Up @@ -126,9 +119,11 @@ def release_to_debian(name, version, debian_version, upload, ignore_upload_error


def clean_all(names):
subfolders = ['deb_dist', 'dist']
subfolders = ['build', 'deb_dist', 'dist']
for name in names:
subfolders += ['%s.egg-info' % name, 'src/%s.egg-info' % name]
if '-' in name:
subfolders += ['%s.egg-info' % name.replace('-', '_')]
remove_trees(subfolders)


Expand Down