Mercurial > p > roundup > code
annotate roundup/dist/command/bdist_rpm.py @ 5632:a29a8dae2095
Initial implementation of function to return data for / and /data
endpoints under /rest/.
/rest/ returns:
1) default_version of the interface and supported_version array
2) list of links with rel and uri properties that indicate
what assets are available under /rest. E.g. /rest/data
/data returns:
a list of possible assets (e.g. issue, user, keyword, status)
and links for accessing those assets.
E.G.
{
"data": {
"keyword": {
"link": "https://example.net/demo/rest/data/keyword"
},
"user": {
"link": "https://example.net/demo/rest/data/user"
}, ...
}
}
Both of these are currently hand coded. Others will be doing more
development on the rest interface. These two examples are meant to
spark discussion on what the payloads returned by the rest interface
should look like and give some ideas around HATEOAS.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 01 Mar 2019 23:24:40 -0500 |
| parents | e233d7a66343 |
| children | 42bf0a707763 |
| rev | line source |
|---|---|
| 4068 | 1 # |
| 2 # Copyright (C) 2009 Stefan Seefeld | |
| 3 # All rights reserved. | |
| 4 # For license terms see the file COPYING.txt. | |
| 5 # | |
| 6 from distutils.command.bdist_rpm import bdist_rpm as base | |
| 7 from distutils.file_util import write_file | |
| 8 import os | |
| 9 | |
| 10 class bdist_rpm(base): | |
| 11 | |
| 12 def finalize_options(self): | |
| 13 base.finalize_options(self) | |
| 14 if self.install_script: | |
| 15 # install script is overridden. skip default | |
| 16 return | |
| 17 # install script option must be file name. | |
| 18 # create the file in rpm build directory. | |
| 19 install_script = os.path.join(self.rpm_base, "install.sh") | |
| 20 self.mkpath(self.rpm_base) | |
| 21 self.execute(write_file, (install_script, [ | |
| 22 ("%s setup.py install --root=$RPM_BUILD_ROOT " | |
| 23 "--record=ROUNDUP_FILES") % self.python, | |
| 24 # allow any additional extension for man pages | |
| 25 # (rpm may compress them to .gz or .bz2) | |
| 26 # man page here is any file | |
| 27 # with single-character extension | |
| 28 # in man directory | |
| 29 "sed -e 's,\(/man/.*\..\)$,\\1*,' " | |
| 30 "<ROUNDUP_FILES >INSTALLED_FILES", | |
| 31 ]), "writing '%s'" % install_script) | |
| 32 self.install_script = install_script | |
| 33 |
