-
Notifications
You must be signed in to change notification settings - Fork 490
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
Remove /opt/graphite prefix and use setuptools #835
Open
piotr1212
wants to merge
9
commits into
graphite-project:master
Choose a base branch
from
piotr1212:setuptools
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bedb234
Use setuptools and don't install in /opt/graphite anymore
piotr1212 8982e0a
setup.py: make classifiers a list
piotr1212 ca40f75
Remove manipulation of paths and environments
piotr1212 6f66405
Merge remote-tracking branch 'origin/master' into setuptools
piotr1212 74a0f93
remove duplicate entry in .gitignore
piotr1212 05b9ce9
restore graphite_root to /opt/graphite
piotr1212 0220257
Don't install sys-v initscripts
piotr1212 402e115
remove unused variable
piotr1212 7eb8ced
remove unused import
piotr1212 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,115 +1,54 @@ | ||
#!/usr/bin/env python | ||
|
||
from __future__ import with_statement | ||
|
||
import os | ||
from glob import glob | ||
try: | ||
from ConfigParser import ConfigParser, DuplicateSectionError # Python 2 | ||
except ImportError: | ||
from configparser import ConfigParser, DuplicateSectionError # Python 3 | ||
|
||
|
||
# Graphite historically has an install prefix set in setup.cfg. Being in a | ||
# configuration file, it's not easy to override it or unset it (for installing | ||
# graphite in a virtualenv for instance). | ||
# The prefix is now set by ``setup.py`` and *unset* if an environment variable | ||
# named ``GRAPHITE_NO_PREFIX`` is present. | ||
# While ``setup.cfg`` doesn't contain the prefix anymore, the *unset* step is | ||
# required for installations from a source tarball because running | ||
# ``python setup.py sdist`` will re-add the prefix to the tarball's | ||
# ``setup.cfg``. | ||
cf = ConfigParser() | ||
|
||
with open('setup.cfg', 'r') as f: | ||
orig_setup_cfg = f.read() | ||
f.seek(0) | ||
cf.readfp(f, 'setup.cfg') | ||
|
||
if os.environ.get('GRAPHITE_NO_PREFIX'): | ||
cf.remove_section('install') | ||
else: | ||
print('#' * 80) | ||
print('') | ||
print('Carbon\'s default installation prefix is "/opt/graphite".') | ||
print('') | ||
print('To install Carbon in the Python\'s default location run:') | ||
print('$ GRAPHITE_NO_PREFIX=True python setup.py install') | ||
print('') | ||
print('#' * 80) | ||
try: | ||
cf.add_section('install') | ||
except DuplicateSectionError: | ||
pass | ||
if not cf.has_option('install', 'prefix'): | ||
cf.set('install', 'prefix', '/opt/graphite') | ||
if not cf.has_option('install', 'install-lib'): | ||
cf.set('install', 'install-lib', '%(prefix)s/lib') | ||
from setuptools import setup | ||
|
||
with open('setup.cfg', 'w') as f: | ||
cf.write(f) | ||
|
||
|
||
if os.environ.get('USE_SETUPTOOLS'): | ||
from setuptools import setup | ||
setup_kwargs = dict(zip_safe=0) | ||
else: | ||
from distutils.core import setup | ||
setup_kwargs = dict() | ||
|
||
|
||
storage_dirs = [ ('storage/ceres/dummy.txt', []), ('storage/whisper/dummy.txt',[]), | ||
('storage/lists',[]), ('storage/log/dummy.txt',[]), | ||
('storage/rrd/dummy.txt',[]) ] | ||
conf_files = [ ('conf', glob('conf/*.example')) ] | ||
storage_dirs = [('storage/ceres/dummy.txt', []), ('storage/whisper/dummy.txt', []), | ||
('storage/lists', []), ('storage/log/dummy.txt', []), | ||
('storage/rrd/dummy.txt', [])] | ||
conf_files = [('conf', glob('conf/*.example'))] | ||
|
||
install_files = storage_dirs + conf_files | ||
|
||
# Let's include redhat init scripts, despite build platform | ||
# but won't put them in /etc/init.d/ automatically anymore | ||
init_scripts = [ ('examples/init.d', ['distro/redhat/init.d/carbon-cache', | ||
'distro/redhat/init.d/carbon-relay', | ||
'distro/redhat/init.d/carbon-aggregator']) ] | ||
install_files += init_scripts | ||
|
||
def read(fname): | ||
with open(os.path.join(os.path.dirname(__file__), fname)) as f: | ||
return f.read() | ||
|
||
try: | ||
setup( | ||
name='carbon', | ||
version='1.2.0', | ||
url='http://graphiteapp.org/', | ||
author='Chris Davis', | ||
author_email='[email protected]', | ||
license='Apache Software License 2.0', | ||
description='Backend data caching and persistence daemon for Graphite', | ||
long_description=read('README.md'), | ||
long_description_content_type='text/markdown', | ||
packages=['carbon', 'carbon.aggregator', 'twisted.plugins'], | ||
package_dir={'' : 'lib'}, | ||
scripts=glob('bin/*'), | ||
package_data={ 'carbon' : ['*.xml'] }, | ||
data_files=install_files, | ||
install_requires=['Twisted', 'txAMQP', 'cachetools', 'urllib3'], | ||
classifiers=( | ||
'Intended Audience :: Developers', | ||
'Natural Language :: English', | ||
'License :: OSI Approved :: Apache Software License', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: Implementation :: CPython', | ||
'Programming Language :: Python :: Implementation :: PyPy', | ||
), | ||
**setup_kwargs | ||
) | ||
finally: | ||
with open('setup.cfg', 'w') as f: | ||
f.write(orig_setup_cfg) | ||
|
||
setup( | ||
name='carbon', | ||
version='1.2.0', | ||
url='http://graphiteapp.org/', | ||
author='Chris Davis', | ||
author_email='[email protected]', | ||
license='Apache Software License 2.0', | ||
description='Backend data caching and persistence daemon for Graphite', | ||
long_description=read('README.md'), | ||
long_description_content_type='text/markdown', | ||
packages=['carbon', 'carbon.aggregator', 'twisted.plugins'], | ||
package_dir={'': 'lib'}, | ||
scripts=glob('bin/*'), | ||
package_data={'carbon': ['*.xml']}, | ||
data_files=install_files, | ||
install_requires=['Twisted', 'txAMQP', 'cachetools', 'urllib3'], | ||
classifiers=[ | ||
'Intended Audience :: Developers', | ||
'Natural Language :: English', | ||
'License :: OSI Approved :: Apache Software License', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: Implementation :: CPython', | ||
'Programming Language :: Python :: Implementation :: PyPy', | ||
], | ||
zip_safe=False | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another
sys.prefix
that should be/opt/graphite
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(actually, this
CONF_DIR
variable is now unused)