Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
opennsa3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Hažlinský
opennsa3
Commits
a388c457
Commit
a388c457
authored
Jan 8, 2021
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Move to a simpler setup.py specific to our environment
parent
b746c816
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
setup.py
+20
-82
20 additions, 82 deletions
setup.py
setup.py.bak
+83
-0
83 additions, 0 deletions
setup.py.bak
with
103 additions
and
82 deletions
setup.py
+
20
−
82
View file @
a388c457
import
os
from
distutils.core
import
setup
from
distutils.command.install
import
install
from
distutils.command.install_data
import
install_data
from
opennsa
import
__version__
# nasty global for relocation
RELOCATE
=
None
class
InstallOpenNSA
(
install
):
def
finalize_options
(
self
):
install
.
finalize_options
(
self
)
global
RELOCATE
;
RELOCATE
=
self
.
home
class
InstallOpenNSAData
(
install_data
):
# this class is used for relocating datafiles, and remove existing etc files
# so we don't overwrite the configuration of existing sites
def
finalize_options
(
self
):
install_data
.
finalize_options
(
self
)
# relocation
if
RELOCATE
:
print
(
'
relocating to {}
'
.
format
(
RELOCATE
))
for
(
prefix
,
files
)
in
reversed
(
self
.
data_files
):
if
prefix
.
startswith
(
'
/
'
):
new_prefix
=
os
.
path
.
join
(
RELOCATE
,
prefix
[
1
:])
self
.
data_files
.
remove
((
prefix
,
files
))
self
.
data_files
.
append
((
new_prefix
,
files
))
# check that we don't overwrite /etc files
for
(
prefix
,
files
)
in
reversed
(
self
.
data_files
):
if
prefix
.
startswith
(
os
.
path
.
join
(
RELOCATE
or
'
/
'
,
'
etc
'
)):
for
basefile
in
files
:
fn
=
os
.
path
.
join
(
prefix
,
os
.
path
.
basename
(
basefile
))
if
os
.
path
.
exists
(
fn
):
print
(
'
Skipping installation of {} (already exists)
'
.
format
(
fn
))
files
.
remove
(
basefile
)
if
not
files
:
self
.
data_files
.
remove
((
prefix
,
[]))
cmdclasses
=
{
'
install
'
:
InstallOpenNSA
,
'
install_data
'
:
InstallOpenNSAData
}
setup
(
name
=
'
opennsa
'
,
version
=
__version__
,
description
=
'
Implementation of the Network Service Interface (NSI)
'
,
author
=
'
Henrik Thostrup Jensen
'
,
author_email
=
'
htj@nordu.net
'
,
url
=
'
http://www.nordu.net/
'
,
packages
=
[
'
opennsa
'
,
'
opennsa/backends
'
,
'
opennsa/backends/common
'
,
'
opennsa/cli
'
,
'
opennsa/plugins
'
,
'
opennsa/discovery
'
,
'
opennsa/discovery/bindings
'
,
'
opennsa/protocols
'
,
'
opennsa/protocols/nsi2
'
,
'
opennsa/protocols/nsi2/bindings
'
,
'
opennsa/protocols/rest
'
,
'
opennsa/protocols/shared
'
,
'
opennsa/shared
'
,
'
opennsa/topology
'
,
from
setuptools
import
setup
,
find_packages
setup
(
name
=
'
opennsa
'
,
version
=
"
3
"
,
author
=
'
GEANT
'
,
author_email
=
'
swd@geant.org
'
,
description
=
'
GEANT OpenNSA Package
'
,
url
=
(
'
https://gitlab.geant.net/live-projects/opennsa
'
),
packages
=
find_packages
(),
install_requires
=
[
'
twisted>=19.7.0
'
,
'
twistar>=2.0
'
,
'
psycopg2>=2.7
'
,
'
pyOpenSSL>=19.1.0
'
,
'
python-dateutil
'
,
'
service_identity
'
,
'
junos-eznc
'
,
],
cmdclass
=
cmdclasses
,
data_files
=
[
(
'
bin
'
,
[
'
onsa
'
]),
(
'
/etc
'
,
[
'
datafiles/opennsa.conf
'
]),
(
'
/etc/init.d
'
,
[
'
datafiles/opennsa
'
]),
]
include_package_data
=
True
,
)
This diff is collapsed.
Click to expand it.
setup.py.bak
0 → 100644
+
83
−
0
View file @
a388c457
import os
from distutils.core import setup
from distutils.command.install import install
from distutils.command.install_data import install_data
from opennsa import __version__
# nasty global for relocation
RELOCATE = None
class InstallOpenNSA(install):
def finalize_options(self):
install.finalize_options(self)
global RELOCATE ; RELOCATE = self.home
class InstallOpenNSAData(install_data):
# this class is used for relocating datafiles, and remove existing etc files
# so we don't overwrite the configuration of existing sites
def finalize_options(self):
install_data.finalize_options(self)
# relocation
if RELOCATE:
print('relocating to {}'.format(RELOCATE))
for (prefix, files) in reversed(self.data_files):
if prefix.startswith('/'):
new_prefix = os.path.join(RELOCATE, prefix[1:])
self.data_files.remove((prefix, files))
self.data_files.append((new_prefix, files))
# check that we don't overwrite /etc files
for (prefix, files) in reversed(self.data_files):
if prefix.startswith(os.path.join(RELOCATE or '/', 'etc')):
for basefile in files:
fn = os.path.join(prefix, os.path.basename(basefile))
if os.path.exists(fn):
print('Skipping installation of {} (already exists)'.format(fn))
files.remove(basefile)
if not files:
self.data_files.remove((prefix, []))
cmdclasses = {'install': InstallOpenNSA, 'install_data': InstallOpenNSAData}
setup(name='opennsa',
version=__version__,
description='Implementation of the Network Service Interface (NSI)',
author='Henrik Thostrup Jensen',
author_email='htj@nordu.net',
url='http://www.nordu.net/',
packages=['opennsa',
'opennsa/backends',
'opennsa/backends/common',
'opennsa/cli',
'opennsa/plugins',
'opennsa/discovery',
'opennsa/discovery/bindings',
'opennsa/protocols',
'opennsa/protocols/nsi2',
'opennsa/protocols/nsi2/bindings',
'opennsa/protocols/rest',
'opennsa/protocols/shared',
'opennsa/shared',
'opennsa/topology',
],
cmdclass = cmdclasses,
data_files=[
('bin', ['onsa']),
('/etc', ['datafiles/opennsa.conf']),
('/etc/init.d', ['datafiles/opennsa']),
]
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment