Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Commit

Permalink
Add the man pages to the pip and rpm packages
Browse files Browse the repository at this point in the history
See issue #138
  • Loading branch information
lmoureaux committed Aug 13, 2018
1 parent 600b949 commit 26e9307
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ LongPackage := gemplotting
PackageName := $(Namespace)_$(ShortPackage)
PackageDir := pkg/$(Namespace)/$(ShortPackage)
ScriptDir := pkg/$(Namespace)/scripts
ManDir := pkg/man

# Explicitly define the modules that are being exported (for PEP420 compliance)
PythonModules = ["$(Namespace).$(ShortPackage)", \
Expand Down Expand Up @@ -45,7 +46,7 @@ default:
# need to ensure that the python only stuff is packaged into RPMs
.PHONY: clean preprpm
_rpmprep: preprpm
preprpm: default
preprpm: default man
@if ! [ -e pkg/installrpm.sh ]; then \
cp -rf config/scriptlets/installrpm.sh pkg/; \
fi
Expand All @@ -56,12 +57,15 @@ preprpm: default
@cp -rf ana_scans.py $(ScriptDir)
@cp -rf anaXDAQLatency.py $(ScriptDir)
@cp -rf packageFiles4Docker.py $(ScriptDir)
$(MakeDir) $(ManDir)
@cp -rf doc/_build/man/* $(ManDir)
-cp -rf README.md LICENSE CHANGELOG.md MANIFEST.in requirements.txt $(PackageDir)
-cp -rf README.md LICENSE CHANGELOG.md MANIFEST.in requirements.txt pkg

clean:
-rm -rf $(ScriptDir)
-rm -rf $(PackageDir)
-rm -rf $(ManDir)
-rm -f pkg/$(Namespace)/__init__.py
-rm -f pkg/README.md
-rm -f pkg/LICENSE
Expand Down
16 changes: 16 additions & 0 deletions pkg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
scriptdir = 'gempython/scripts'
scriptpath = '/opt/cmsgemos/bin'
scripts = listdir(scriptdir)
mandir = 'man'

def readme():
with open('README.md') as f:
Expand Down Expand Up @@ -53,6 +54,20 @@ def getVersion():
""".format(__version__,__release__,__buildtag__,__gitrev__,__gitver__,__packager__,__builddate__))
return '{0:s}'.format(__version__)

def getdatafiles():
data_files = []

# Man files
man_sections = {}
for file in listdir(mandir):
print('Found man page: %s' % file)
section = file.split('.')[-1]
man_sections[section] = man_sections.get(section, []) + [join(mandir, file)]
for section in man_sections:
data_files.append(('share/man/man%s' % section, man_sections[section]))

return data_files

setup(name = '__packagename__',
version = getVersion(),
# use_scm_version = True,
Expand All @@ -66,6 +81,7 @@ def getVersion():
url = 'https://cms-gem-daq-project.github.io/gem-plotting-tools',
# namespace_package = "gempython",
# packages = __pythonmodules__, # for PEP420 native namespace util
data_files = getdatafiles(),
packages = find_packages(), # for pkgutil namespace method
include_package_data = True,
package_data = getpkgdata(),
Expand Down

0 comments on commit 26e9307

Please sign in to comment.