diff --git a/_extras/customization.md b/_extras/customization.md deleted file mode 100644 index b4ae515..0000000 --- a/_extras/customization.md +++ /dev/null @@ -1,327 +0,0 @@ ---- -layout: page -title: Customizing Your Workshop's Website -permalink: /customization/index.html ---- - -## Table of Content - -* TOC -{:toc} - -## Configuration File `_config.yml` - -You should edit the `_config.yml` configuration file in the root directory of your workshop to -configure some site-wide variables and make the site function correctly: - -* `carpentry` - to tell us which carpentry workshop this is. Possible values are: - - `"swc"` for Software Carpentry workshops, - - `"dc"` for Data Carpentry workshops, - - `"lc"` for Library Carpentry workshops, and - - `"cp"` for general Carpentries events such as instructor trainings (for which you should use - as the website template). - - `"incubator"` for workshops teaching a lesson in The Carpentries Incubator. -* `curriculum` - to tell us which curriculum is being taught. - At the moment, applicable to Software and Data Carpentry workshops only. - Possible values are: - - `"dc-astronomy"`, `"dc-ecology"`, `"dc-genomics"`, `"dc-socsci"`, `"dc-geospatial"`, or `"dc-image"` for Data Carpentry - workshops - - `"swc-inflammation"` or `"swc-gapminder"` for Software Carpentry workshops. -* `flavor` - `"r"` or `"python"` depending on which lessons are being taught at the workshop - (currently only for Data Carpentry and Software Carpentry workshops). -* `pilot` - set this to `true` if the workshop will be a lesson pilot - (of a new official lesson or a lesson in The Carpentries Incubator). -* `title` - overall title for the workshop. If set (i.e., different from "Workshop Title" or empty), - it will appear in the "jumbotron" (the gray box at the top of the page). This variable is also - used for the title of the extra pages. The README contains [more information about extra pages](https://github.com/carpentries/workshop-template#creating-extra-pages). - -### Slug Validation - -For workshops teaching a core or mix and match curriculum, i.e. -where `carpentry` is set to `swc`, `dc`, or `lc`, the website build -will check that your repository name matches the Carpentries slug -format - `YYYY-MM-DD-site[-online]`, e.g. `2024-05-07-oomza-online`. - -**If your repository name does not match this format, the build will -fail, and will direct you to rename your workshop website repository -to a valid slug.** You will then need to commit a change to the repo -to rebuild the site, e.g. adding a space or other inconsequential -change to the `README.md`. - -Workshop websites using `cp` or `incubator` will go through the same -check, but the build will not fail if the repo name does not match -the slug format. You will see a warning in the build output instead. - -### Incubator lessons - -For workshops teaching lessons in The Carpentries Incubator, -i.e. where `carpentry` is set to `incubator`, -you should uncomment the following three fields in -`_config.yml`: - -* `incubator_lesson_site` - the URL of the lesson pages that will be taught at the workshop. -* `incubator_pre_survey` - the URL of the pre-workshop survey you have prepared for the pilot workshop. (The standard Carpentries pre- and post-workshop surveys should not be used for Incubator workshops.) -* `incubator_post_survey` - the URL of the post-workshop survey you have prepared for the pilot workshop. - -## Site URL - -GitHub Pages sites are formatted as `https://GITHUB_USERNAME.github.io/REPOSITORY_NAME`. -For example, if the URL for your repository is `https://github.com/gvwilson/2015-07-01-oomza`, -the URL for its website will be `http://gvwilson.github.io/2015-07-01-oomza`. - -You should not need to modify any of the other variable values in `_config.yml`. - -## Home Page (`index.md`): data in the YAML header - -Your workshop's home page lives in `index.md`, -which must define the values below in its header. -If your workshop is taught online, see the -[online workshops section](#for-online-workshops) for customization -options. - -* `layout` must be `workshop`. - -* `venue` is the short name of the institution or group hosting the - workshop, like "Euphoric State University". It should *not* - include the address or other details, since this value is - displayed in a table on websites (e.g., - ). See section - below for value to use for online workshops. - -* `address` is the workshop's address (including details like the - room number). The address should be all on one line. - See section below for value to use for online workshops. - -* `country` must be a two-letter ISO-3166 code for the country in - which the workshop is going to take place, such as "fr" (for - France) or "nz" (for New Zealand) - see [ISO-3166 codes on Wikipedia](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) - for a complete list. See section below for value to use for - online workshops. - -* `language` is the language that will be used in the workshop. - It must be an [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). - Note that two-letter codes mean different things for countries - and languages: "ar" is Arabic when used for a language, but - Argentina when used for a country. - -* `latitude` and `longitude` are the latitude and longitude of the workshop - site (so we can put a pin on our map). You can use - [LatLong.net](https://www.latlong.net/) to find these values. - See section below for value to use for online workshops. - -* `humandate` is the human-friendly start and end date for the - workshop. Please use three-letter month names and abbreviations - (e.g., `Jul` instead of `July`), since these values are displayed - in a table on our websites. (Strictly speaking this information - is redundant, since we require a machine-readable `startdate` and - `enddate`, but reliably translating those into human-readable - dates is an interesting challenge...) - -* `humantime` is the human-friendly start and end time for each day of - the workshop, e.g., "09:00 am - 4:00 pm" or "09:00-16:00". (We - recognize that we ought to allow different start or end times on - different days, but going down that path leads eventually to - embedding iCal date/time specifications in our headers, which in - turn leads to madness...) - -* `startdate` is the workshop's starting date in YYYY-MM-DD format, - such as `2015-07-01`. You must use four digits for the year and - two each for the month and day. - -* `enddate` is the workshop's ending date in the same format. If your - workshop is only one day long, the `enddate` field should be deleted. - If your workshop has a more complicated schedule (e.g., a half day a - week for four weeks), please delete the `enddate` field and only tell - us its start date. - -* `instructor` is a comma-separated list of instructor names. The - list must be enclosed in square brackets, and each name must be in - double quotes, as in `["Alan Turing","Grace Hopper"]`. Do not - include other information (such as the word "instructor") in these - values. - -* `helper` is a comma-separated list of helper names formatted in the - same way as the instructor names. If there are no helpers, use an - empty list `[]`. - -* `contact` is the contact email address to use for your workshop. - If you do not provide a contact email address, your website will - display the address for the workshop coordinators (who probably - won't be able to answer questions about the specific details of - your workshop). - -The header may optionally define the following: - -* `collaborative_notes` is the URL for the Etherpad for your workshop. - If you are not using an Etherpad, you can delete this line. You can - [create a carpentries etherpad here](https://pad.carpentries.org/). - -* `eventbrite` is the multi-digit Eventbrite registration key. If you - are using Eventbrite, the Carpentries Regional Coordinators will - give this to you. If you are using something else, you may delete - this line. Note: this value must be given as a string in double - quotes, rather than as a number. - -### For online workshops - -If the workshop is online, follow the same instructions as above with the -following modifications: - -* `venue`: Use the name of the institution that organizes the workshop and do - not include a mention that it is an online workshop. -* `address`: If you can safely share the URL for the videoconferencing, you may - list it here (it must start with `http` or `https`); if you cannot or prefer - to not share the videoconferencing information, use the value `online`. -* `country`: Please use the country associated with the host institution for the - workshop. -* `latitude` and `longitude`: if it makes sense, use the coordinates for the - host institution. If it does not, use `0` for both the latitude and the - longitude. - -By default, the Setup Instructions will list the installation instructions for the -videoconferencing service Zoom. -If you use a different videoconferencing service, -you can edit the file in `_includes/install_instructions/videoconferencing.html` -to include the relevant installation instructions. - -## Home Page: Schedule - -By default, the template displays the typical schedule for your workshop based on -the values of the variables set in the `_config.yml`. If you need to make -minor modifications to this schedule, you can edit the `schedule.html` file -found in the sub-folder of the `_includes` folder that matches the type of -workshop you will be teaching (`dc`, `lc`, or `swc`). - -If you wish to create your own custom schedule, an empty template is available in -`_includes/custom-schedule.html`. In this file, we provide the structure for a -4-day workshop as it is often used for online workshops. To use this custom -schedule instead of the one provided by default in the template, delete the -block of code found under the "Schedule" header in the `index.md` file and -replace it with`{% raw %}{% include custom-schedule.html %}{% endraw %}`. - -The schedule is formatted using a table. If you would like to learn more about -how to write tables in HTML, here is an [HTML table overview from -Mozilla](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table) and -the [HTML tables chapter from w3schools](https://www.w3schools.com/html/html_tables.asp). - -For pilot workshops, some placeholder text including a link to the lesson homepage -will be displayed instead of a schedule table. -The lesson homepage will contain estimated timings for teaching the lesson. -Use the approach described above for `_includes/custom-schedule.html` -if you would like to create a schedule table to replace this text. - -## Home Page: Setup Instructions - -If you need assistance with customizing the setup instructions for your website, -feel free to ask your questions in the Carpentries -[Instructors Slack channel](https://carpentries.slack.com/archives/C08BVNU00) -([join The Carpentries Slack workspace](https://slack-invite.carpentries.org/)). - -### Software Carpentry workshops - -#### Default settings - -For Software Carpentry workshops, -setting the `flavor` variable in `_config.yml` to `r` or `python` -will include the respective installation instructions for these tools. -Additionally, by default, the installation instructions for -a text editor, the Bash shell, and Git are included. - -#### If you need to remove tools - -If you need to remove any of the instructions for the default -set of tools, -you can delete lines that include these instructions in -the `_includes/swc/setup.html` file. - -#### If you need to add tools - -If you need to add installation instructions for other tools, -we provide installation instructions for SQL and OpenRefine. -To make them appear on your workshop website, -you can move the `{% raw %}{% include %}{% endraw %}` statements outside the comment -block in `_includes/swc/setup.html`. - -If you need to add installation instructions for other tools, -you will need to write your own. You can use installation instructions -for other tools located in the `_includes/install_instructions/` folder -as examples. - -### Data Carpentry workshops - -For Data Carpentry workshops, -installation instructions live on the workshop overview page for each curriculum. -Instead of including installation instructions in the workshop template, -the workshop template includes links to these instructions. -The correct link will be displyed -when using the appropriate combination of values -for the `curriculum` and `flavor` variables -in the `_config.yml` file. - -### Library Carpentry workshops - -By default, Library Carpentry workshop websites -include installation instructions for the Bash shell and Git. - -You may need to add installation instructions for additional tools -you will be using during your workshop -by editing the `_includes/lc/setup.html` file. -You can either write your own instructions using the ones -provided in `_includes/lc/setup.html` as an example, -or, if you are using tools that already have installation instructions -provided for Software Carpentry, -you can add `{% raw %}{% include install_instructions/ %}{% endraw %}` -where `` needs to be replaced by one of the files -in the `_includes/install_instructions` folder. - -## Homepage: who can attend? - -If you want to specify who can attend the workshop you are advertising, -there is a commented-out section in `index.md` that you can use to -inform workshop website visitors of who can attend the event. -You may want to specify that only members of your university, -department, etc. can attend or that the event is open to the public. -We don't provide templated text for this as each situation is different. -We do provide a section, called "Who can attend?" for you to specify this -information. - -To use it, move the {% raw %}{% endcomment %}{% endraw %} line above the -`

` tag marking the beginning of this section and edit the paragraph -to reflect the attendance policy for your workshop. - -## Updating the repository - -If for some reason, -such as the installation instructions having become disconnected -with the current lesson material, -you need to get changes from this repository -into the clone of it with your workshop page, -please follow the steps bellow: - -1. Add the workshop-template repository as upstream: - ~~~ - $ git remote add upstream https://github.com/carpentries/workshop-template.git - ~~~ - {: .language-bash} - -2. Fetch the data from upstream repository (also know as the workshop-template - repository): - ~~~ - $ git pull upstream - ~~~ - {: .language-bash} - -3. Address possible merge conflicts, and - ~~~ - $ git commit -a - ~~~ - {: .language-bash} - -4. Push the changes to your repository on GitHub: - ~~~ - $ git push origin gh-pages - ~~~ - {: .language-bash} - - -{% include links.md %} diff --git a/_extras/install_instructions.md b/_extras/install_instructions.md deleted file mode 100644 index 7442ede..0000000 --- a/_extras/install_instructions.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -layout: page -title: Installation Instructions -permalink: /install_instructions/index.html -tools: - - editor - - git - - openrefine - - python - - r - - shell - - sql - - videoconferencing ---- - -{% comment %} -To add a new set of installation instructions to this page: -1. Add the instructions (in HTML) as a new file in the `_includes` folder -2. Add the name of that file, without the .html extension, - to the `tools` array in the YAML front matter of this page - (i.e. between the --- above). -{% endcomment %} - -{% for tool in page.tools %} -{% include install_instructions/{{tool}}.html %} -{% endfor %} diff --git a/_includes/dc/intro.html b/_includes/dc/intro.html deleted file mode 100644 index 016707c..0000000 --- a/_includes/dc/intro.html +++ /dev/null @@ -1,15 +0,0 @@ -

- Data Carpentry develops and teaches workshops on the fundamental data skills needed to conduct - research. Its target audience is researchers who have little to no prior computational experience, - and its lessons are domain specific, building on learners' existing knowledge to enable them to quickly - apply skills learned to their own research. - Participants will be encouraged to help one another - and to apply what they have learned to their own research problems. -

-

- - For more information on what we teach and why, - please see our paper - "Good Enough Practices for Scientific Computing". - -

diff --git a/_includes/dc/schedule.html b/_includes/dc/schedule.html deleted file mode 100644 index 342974d..0000000 --- a/_includes/dc/schedule.html +++ /dev/null @@ -1,237 +0,0 @@ -{% comment %} -This is the typical schedule for the Data Carpentry workshops. -The schedule for the different curricula are listed here: -- dc-astronomy -- dc-ecology -- dc-genomics -- dc-image -- dc-socsci -- dc-geosptial -{% endcomment %} - -{% if site.curriculum == "dc-astronomy" %} -
- -
-

Day 2

- - - - - -
MorningTransform and Select
Join
AfternoonPhotometry
Visualization
-
-
- -{% elsif site.curriculum == "dc-image" %} - - -{% elsif site.curriculum == "dc-ecology" %} -
-
-

Day 1

- - - - - - - - - - - -
Before startingPre-workshop survey
Morning Data Organization in Spreadsheets
OpenRefine for Data Cleaning
Afternoon - {% if site.flavor == "r" %} - Introduction to R - {% elsif site.flavor == "python" %} - Introduction to Python - {% else %} - {% include warning-flavor.html %} - {% endif %} -
Evening END
-
-
-

Day 2

- - - - - - - - - - - - - -
Morning - {% if site.flavor == "r" %} - Continuation of R: Data analysis and Visualization - {% elsif site.flavor == "python" %} - Continuation of Python: Data analysis and Visualization - {% else %} - {% include warning-flavor.html %} - {% endif %} -
AfternoonData Management with SQL
EveningPost-workshop survey
END
-
-
- -{% elsif site.curriculum == "dc-genomics" %} - - - -{% elsif site.curriculum == "dc-socsci" %} - -
-
-

Day 1

- - - - - - - - - -
Before startingPre-workshop survey
Morning Data Organization in Spreadsheets
OpenRefine for Data Cleaning
AfternoonIntroduction to R
Evening END
-
-
-

Day 2

- - - - - - - - - - - -
Morning Continuation of R: Data Analysis & Visualization
AfternoonData Management with SQL
EveningPost-workshop survey
END
-
-
- - -{% elsif site.curriculum == "dc-geospatial" %} - - - -{% else %} -{% include warning-curriculum.html %} -{% endif %} diff --git a/_includes/dc/setup.html b/_includes/dc/setup.html deleted file mode 100644 index 439025b..0000000 --- a/_includes/dc/setup.html +++ /dev/null @@ -1,85 +0,0 @@ -{% comment %} -Astronomy workshops -{% endcomment %} - - -{% if site.curriculum == "dc-astronomy" %} - -

- The setup instructions for the Data Carpentry Astronomy workshops - can be found at - the curriculum site. -

- -{% comment %} -Ecology workshops -{% endcomment %} - - -{% elsif site.curriculum == "dc-ecology" %} - -{% if site.flavor == "r" %} -

- The setup instructions for the Data Carpentry Ecology workshops (with R) - can be found at - the workshop overview site. -

- -{% elsif site.flavor == "python" %} -

- The setup instructions for the Data Carpentry Ecology workshops (with Python) - can be found at - the workshop overview site. -

-{% else %} -{% include warning-flavor.html %} -{% endif %} - -{% comment %} -Genomics workshops -{% endcomment %} - -{% elsif site.curriculum == "dc-genomics" %} -

The setup instructions for the Data Carpentry Genomics workshops can be found at the workshop overview site

. - -{% comment %} -Geospatial workshops -{% endcomment %} - -{% elsif site.curriculum == "dc-geospatial" %} -

The setup instructions for the Data Carpentry Geospatial workshop can be found at the workshop overview site.

- -{% comment %} -Image workshops -{% endcomment %} - -{% elsif site.curriculum == "dc-image" %} - -

The setup instructions for Data Carpentry Image Processing workshops can be found at the curriculum site.

- -{% comment %} -Social sciences workshops -{% endcomment %} - -{% elsif site.curriculum == "dc-socsci" %} - -{% if site.flavor == "r" %} -

- The setup instructions for the Data Carpentry Social Sciences - workshops (with R) can be found at - the workshop overview site. -

- -{% elsif site.flavor == "python" %} -

- The setup instructions for the Data Carpentry Social Sciences workshops (with Python) - can be found at - the workshop overview site. -

-{% else %} -{% include warning-flavor.html %} -{% endif %} - -{% else %} -{% include warning-curriculum.html %} -{% endif %} diff --git a/_includes/dc/who.html b/_includes/dc/who.html deleted file mode 100644 index 28e38ae..0000000 --- a/_includes/dc/who.html +++ /dev/null @@ -1,59 +0,0 @@ -{% comment %} -Astronomy workshops -{% endcomment %} - - -{% if site.curriculum == "dc-astronomy" %} - -

- Who: -This lesson assumes you have a working knowledge of Python and some previous exposure to the Bash shell. - These requirements can be fulfilled by: - a) completing a Software Carpentry Python workshop or - b) completing a Data Carpentry Ecology workshop (with Python) and a Data Carpentry Genomics workshop or - c) independent exposure to both Python and the Bash shell. - -If you’re unsure whether you have enough experience to participate in this workshop, please read over - this detailed list, - which gives all of the functions, operators, and other concepts you will need to be familiar with. - -In addition, this lesson assumes that learners have some familiarity with astronomical concepts, - including reference frames, proper motion, color-magnitude diagrams, globular clusters, and isochrones. - Participants should bring their own laptops and plan to participate actively. -

- -{% comment %} -Image workshops -{% endcomment %} - -{% elsif site.curriculum == "dc-image" %} - -

- Who: -This lesson assumes you have a working knowledge of Python and some previous exposure to the Bash shell. - These requirements can be fulfilled by: - a) completing a Software Carpentry Python workshop or - b) completing a Data Carpentry Ecology workshop (with Python) and a Data Carpentry Genomics workshop or - c) independent exposure to both Python and the Bash shell. - -If you’re unsure whether you have enough experience to participate in this workshop, please read over - this detailed list, - which gives all of the functions, operators, and other concepts you will need to be familiar with. -

- -{% comment %} -All other workshops -{% endcomment %} - -{% else %} - -

- Who: - The course is aimed at graduate students and other researchers. - - You don't need to have any previous knowledge of the tools - that will be presented at the workshop. - -

- -{% endif %} diff --git a/_includes/install_instructions/editor.html b/_includes/install_instructions/editor.html deleted file mode 100644 index 373c4a9..0000000 --- a/_includes/install_instructions/editor.html +++ /dev/null @@ -1,51 +0,0 @@ -
-

Text Editor

- -

- When you're writing code, it's nice to have a text editor that is - optimized for writing code, with features like automatic - color-coding of key words. The default text editor on macOS and - Linux is usually set to Vim, which is not famous for being - intuitive. If you accidentally find yourself stuck in it, hit - the Esc key, followed by :+Q+! - (colon, lower-case 'q', exclamation mark), then hitting Return to - return to the shell. -

- -
- - -
-
-

- nano is a basic editor and the default that instructors use in the workshop. - It is installed along with Git. -

-
-
-

- nano is a basic editor and the default that instructors use in the workshop. - See the Git installation video tutorial - for an example on how to open nano. - It should be pre-installed. -

-

Video Tutorial

-
-
- -
-
-
-
-

- nano is a basic editor and the default that instructors use in the workshop. - It should be pre-installed. -

-
-
-
-
diff --git a/_includes/install_instructions/git.html b/_includes/install_instructions/git.html deleted file mode 100644 index 9a4f2ac..0000000 --- a/_includes/install_instructions/git.html +++ /dev/null @@ -1,76 +0,0 @@ -{% comment %} -Git Setup instructions rely on Shell instructions. If you don't include -Shell instructions as part of your workshop website, make sure to adjust -the text below accordingly. -{% endcomment %} -
-

Git

-

- Git is a version control system that lets you track who made changes - to what when and has options for easily updating a shared or public - version of your code - on github.com. You will need a - supported - web browser. -

-

- You will need an account at github.com - for parts of the Git lesson. Basic GitHub accounts are free. We encourage - you to create a GitHub account if you don't have one already. - Please consider what personal information you'd like to reveal. For - example, you may want to review these - instructions - for keeping your email address private provided at GitHub. -

- -
- - -
- -
-

- Please open the Terminal app, type git --version and press - Enter/Return. If it's not installed already, - follow the instructions to Install the "command line - developer tools". Do not click "Get Xcode", because that will - take too long and is not necessary for our Git lesson. - After installing these tools, there won't be anything in your /Applications - folder, as they and Git are command line programs. - For older versions of OS X (10.5-10.8) use the - most recent available installer labelled "snow-leopard" - available here. - (Note: this project is no longer maintained.) - Because this installer is not signed by the developer, you may have to - right click (control click) on the .pkg file, click Open, and click - Open in the pop-up dialog. You can watch - a video tutorial about this case. -

-

Video Tutorial

-
-
- -
-
-
-
-

- If Git is not already available on your machine you can try to - install it via your distro's package manager. For Debian/Ubuntu run - sudo apt-get install git and for Fedora run - sudo dnf install git. -

-
-
-
-
diff --git a/_includes/install_instructions/openrefine.html b/_includes/install_instructions/openrefine.html deleted file mode 100644 index 75daad1..0000000 --- a/_includes/install_instructions/openrefine.html +++ /dev/null @@ -1,57 +0,0 @@ -
-

OpenRefine

-

- For this lesson you will need OpenRefine and a - web browser. Note: this is a Java program that runs on your machine (not in the cloud). - It runs inside a web browser, but no web connection is needed. -

- -
- - -
-
-
    -
  1. - Check that you have either the Firefox or the Chrome browser installed and set as your default browser. - OpenRefine runs in your default browser. - It will not run correctly in Internet Explorer. -
  2. -
  3. Download software from http://openrefine.org/
  4. -
  5. Create a new directory called OpenRefine.
  6. -
  7. Unzip the downloaded file into the OpenRefine directory by right-clicking and selecting "Extract ...".
  8. -
  9. Go to your newly created OpenRefine directory.
  10. -
  11. Launch OpenRefine by clicking openrefine.exe (this will launch a command prompt window, but you can ignore that - just wait for OpenRefine to open in the browser).
  12. -
  13. If you are using a different browser, or if OpenRefine does not automatically open for you, point your browser at http://127.0.0.1:3333/ or http://localhost:3333 to use the program.
  14. -
-
-
-
    -
  1. Check that you have either the Firefox or the Chrome browser installed and set as your default browser. OpenRefine runs in your default browser. It may not run correctly in Safari.
  2. -
  3. Download software from http://openrefine.org/.
  4. -
  5. Create a new directory called OpenRefine.
  6. -
  7. Unzip the downloaded file into the OpenRefine directory by double-clicking it.
  8. -
  9. Go to your newly created OpenRefine directory.
  10. -
  11. Launch OpenRefine by dragging the icon into the Applications folder.
  12. -
  13. Use Ctrl-click/Open ... to launch it.
  14. -
  15. If you are using a different browser, or if OpenRefine does not automatically open for you, point your browser at http://127.0.0.1:3333/ or http://localhost:3333 to use the program.
  16. -
-
-
-
    -
  1. Check that you have either the Firefox or the Chrome browser installed and set as your default browser. OpenRefine runs in your default browser.
  2. -
  3. Download software from http://openrefine.org/.
  4. -
  5. Make a directory called OpenRefine.
  6. -
  7. Unzip the downloaded file into the OpenRefine directory.
  8. -
  9. Go to your newly created OpenRefine directory.
  10. -
  11. Launch OpenRefine by entering ./refine into the terminal within the OpenRefine directory.
  12. -
  13. If you are using a different browser, or if OpenRefine does not automatically open for you, point your browser at http://127.0.0.1:3333/ or http://localhost:3333 to use the program.
  14. -
-
-
-
-
diff --git a/_includes/install_instructions/python.html b/_includes/install_instructions/python.html deleted file mode 100644 index dd7e5e2..0000000 --- a/_includes/install_instructions/python.html +++ /dev/null @@ -1,113 +0,0 @@ -{% comment %} - -Remove the third paragraph if the workshop will teach Python -using something other than the Jupyter Notebook. Details at - -https://jupyter-notebook.readthedocs.io/en/stable/notebook.html#browser-compatibility -{% endcomment %} -
-

Python

- -

- Python is a popular language for - research computing, and great for general-purpose programming as - well. Installing all of its research packages individually can be - a bit difficult, so we recommend - Anaconda, - an all-in-one installer. -

- -

- Regardless of how you choose to install it, - please make sure you install Python version 3.x - (e.g., 3.6 is fine). -

- - {% comment %} - Please remove or comment out this paragraph using - or {% comment %} and {% endcomment %} - if you do not plan to use Jupyter Notebook environment. - {% endcomment %} -

- We will teach Python using the Jupyter Notebook, - a programming environment that runs in a web browser (Jupyter Notebook will be installed by Anaconda). For this to work you will need a reasonably - up-to-date browser. The current versions of the Chrome, Safari and - Firefox browsers are all - supported - (some older browsers, including Internet Explorer version 9 - and below, are not). -

- -
- - -
-
-
    -
  1. Open https://www.anaconda.com/download/success with your web browser.
  2. -
  3. Download the Anaconda for Windows installer with Python 3. (If you are not sure which version to choose, you probably want the 64-bit Graphical Installer Anaconda3-...-Windows-x86_64.exe)
  4. -
  5. Install Python 3 by running the Anaconda Installer, using all of the defaults for installation except make sure to check Add Anaconda to my PATH environment variable.
  6. -
-

Video Tutorial

-
-
- -
-
-
-
-
    -
  1. Open https://www.anaconda.com/download/success with your web browser.
  2. -
  3. Download the Anaconda Installer with Python 3 for macOS (you can either use the Graphical or the Command Line Installer).
  4. -
  5. Install Python 3 by running the Anaconda Installer using all of the defaults for installation.
  6. -
-

Video Tutorial

-
-
- -
-
-
-
-
    -
  1. Open https://www.anaconda.com/download/success with your web browser.
  2. -
  3. Download the Anaconda Installer with Python 3 for Linux.
    - (The installation requires using the shell. If you aren't - comfortable doing the installation yourself - stop here and request help at the workshop.) -
  4. -
  5. - Open a terminal window and navigate to the directory where - the executable is downloaded (e.g., `cd ~/Downloads`). -
  6. -
  7. - Type
    bash Anaconda3-
    and then press - Tab to autocomplete the full file name. The name of - file you just downloaded should appear. -
  8. -
  9. - Press Enter - (or Return depending on your keyboard). - You will follow the text-only prompts. - To move through the text, press Spacebar. - Type yes and press enter to approve the license. - Press Enter (or Return) - to approve the default location - for the files. - Type yes and press - Enter (or Return) - to prepend Anaconda to your PATH - (this makes the Anaconda distribution the default Python). -
  10. -
  11. - Close the terminal window. -
  12. -
-
-
-
-
diff --git a/_includes/install_instructions/r.html b/_includes/install_instructions/r.html deleted file mode 100644 index 3517050..0000000 --- a/_includes/install_instructions/r.html +++ /dev/null @@ -1,67 +0,0 @@ -
-

R

- -

- R is a programming language - that is especially powerful for data exploration, visualization, and - statistical analysis. To interact with R, we use - RStudio. -

- -
- - -
-
-

- Install R by downloading and running - this .exe file - from CRAN. - Also, please install the - RStudio IDE. - Note that if you have separate user and admin accounts, you should run the - installers as administrator (right-click on .exe file and select "Run as - administrator" instead of double-clicking). Otherwise problems may occur later, - for example when installing R packages. -

-

Video Tutorial

-
-
- -
-
-
-
-

- Install R by downloading and running - this .pkg file - from CRAN. - Also, please install the - RStudio IDE. -

-

Video Tutorial

-
-
- -
-
-
-
-

- Instructions for R installation on various Linux platforms (debian, - fedora, redhat, and ubuntu) can be found at - . These will instruct you to - use your package manager (e.g. for Fedora run - sudo dnf install R and for Debian/Ubuntu, add a ppa - repository and then run sudo apt-get install r-base). - Also, please install the - RStudio IDE. -

-
-
-
-
diff --git a/_includes/install_instructions/shell.html b/_includes/install_instructions/shell.html deleted file mode 100644 index 534ff29..0000000 --- a/_includes/install_instructions/shell.html +++ /dev/null @@ -1,162 +0,0 @@ -
-

The Bash Shell

-

- Bash is a commonly-used shell that gives you the power to do - tasks more quickly. -

- -
- - -
-
-
    -
  1. Download the Git for Windows installer.
  2. -
  3. Run the installer and follow the steps below: -
      - {% comment %} Git 2.29.1 Setup {% endcomment %} -
    1. - Click on "Next" four times (two times if you've previously - installed Git). You don't need to change anything - in the Information, location, components, and start menu screens. -
    2. -
    3. - - From the dropdown menu, "Choosing the default editor used by Git", select "Use the Nano editor by default" (NOTE: you will need to scroll up to find it) and click on "Next". - -
    4. - {% comment %} Adjusting the name of the initial branch in new repositories {% endcomment %} -
    5. - On the page that says "Adjusting the name of the initial branch in new repositories", ensure that - "Let Git decide" is selected. This will ensure the highest level of compatibility for our lessons. - {% comment %} - This section also has "Override the default branch name for new repositories" and has a text box set - to "main". I'm not having people switch to this just yet because our git lesson still uses the old paradigm. - {% endcomment %} -
    6. - {% comment %} Adjusting your PATH environment {% endcomment %} -
    7. - Ensure that "Git from the command line and also from 3rd-party software" is selected and - click on "Next". (If you don't do this Git Bash will not work properly, requiring you to - remove the Git Bash installation, re-run the installer and to select the "Git from the - command line and also from 3rd-party software" option.) -
    8. - {% comment %} Choosing the SSH executable {% endcomment %} -
    9. - Select "Use bundled OpenSSH". -
    10. - {% comment %} Choosing HTTPS transport backend {% endcomment %} -
    11. - Ensure that "Use the native Windows Secure Channel Library" is selected and click on "Next". -
    12. - {% comment %} This should mean that people stuck behind corporate firewalls that do MITM attacks - with their own root CA are still able to access remote git repos. {% endcomment %} - {% comment %} Configuring the line ending conversions {% endcomment %} -
    13. - Ensure that "Checkout Windows-style, commit Unix-style line endings" is selected and click on "Next". -
    14. - {% comment %} Configuring the terminal emulator to use with Git Bash {% endcomment %} -
    15. - - Ensure that "Use Windows' default console window" is selected and click on "Next". - -
    16. - {% comment %} Configuring extra options {% endcomment %} -
    17. - Ensure that "Default (fast-forward or merge) is selected and click "Next" -
    18. -
    19. - Ensure that "Git Credential Manager" is selected and click on "Next". -
    20. -
    21. - Ensure that "Enable file system caching" is selected and click on "Next". -
    22. - {% comment %} Configuring experimental options {% endcomment %} -
    23. Click on "Install".
    24. - {% comment %} Installing {% endcomment %} - {% comment %} Completing the Git Setup Wizard {% endcomment %} - {% comment %} as of 2020-06-02, the Window will say "click Finish", but the button is labelled as "Next" {% endcomment %} -
    25. Click on "Finish" or "Next".
    26. -
    -
  4. -
  5. - If your "HOME" environment variable is not set (or you don't know what this is): -
      -
    1. Open command prompt (Open Start Menu then type cmd and press Enter)
    2. -
    3. - Type the following line into the command prompt window exactly as shown: -

      setx HOME "%USERPROFILE%"

      -
    4. -
    5. Press Enter, you should see SUCCESS: Specified value was saved.
    6. -
    7. Quit command prompt by typing exit then pressing Enter
    8. -
    -
  6. -
-

This will provide you with both Git and Bash in the Git Bash program.

-

Video Tutorial

-
-
- -
-
-
-
-

- The default shell in Mac OS X Ventura and newer versions is Zsh, but - Bash is available in all versions, so no need to install anything. - You access Bash from the Terminal (found in - /Applications/Utilities). - See the Git installation video tutorial - for an example on how to open the Terminal. - You may want to keep Terminal in your dock for this workshop. -

-

- To see if your default shell is Bash type echo $SHELL - in Terminal and press the Return key. If the message - printed does not end with '/bash' then your default is something - else, you can change your current shell to Bash by typing - bash and then pressing Return. To check - your current shell type echo $0 and press Return. -

-

- To change your default shell to Bash type chsh -s /bin/bash and - press the Return key, then reboot for the change to take effect. To - change your default back to Zsh, type chsh -s /bin/zsh, press the - Return key and reboot. To check available shells, type - cat /etc/shells. -

-

Video Tutorial

-
-
- -
-
-
-
-

- The default shell is usually Bash and there is usually no need to - install anything. -

-

- To see if your default shell is Bash type echo $SHELL - in Terminal and press the Return key. If the message - printed does not end with '/bash' then your default is something - else, you can change your current shell to Bash by typing - bash and then pressing Return. To check - your current shell type echo $0 and press Return. -

-

- To change your default shell to Bash type chsh -s /bin/bash and - press the Return key, then reboot for the change to take effect. To - change your default back to Zsh, type chsh -s /bin/zsh, press the - Return key and reboot. To check available shells, type - cat /etc/shells. -

-
-
-
-
diff --git a/_includes/install_instructions/sql.html b/_includes/install_instructions/sql.html deleted file mode 100644 index 365ee6e..0000000 --- a/_includes/install_instructions/sql.html +++ /dev/null @@ -1,53 +0,0 @@ -
-

SQLite

- -

- SQL is a specialized programming language used with databases. We - use a database manager called - SQLite in our lessons. -

- -
- -
-
-
    -
  • Run "Git Bash" from the Start menu
  • -
  • Copy the following curl -fsSL {{site.url}}{{site.baseurl}}/getsql.sh | bash
  • -
  • Paste it into the window that Git Bash opened. If you're unsure, ask an instructor for help
  • -
  • You should see something like 3.27.2 2019-02-25 16:06:06 ...
  • -
- -

If you want to do this manually, download sqlite3, make a bin directory in the user's home directory, unzip sqlite3, move it into the bin directory, and then add the bin directory to the path.

- -
-
-

- SQLite comes pre-installed on macOS. -

-
-
-

- SQLite comes pre-installed on Linux. -

-
-
- -
-
-
- -

If you installed Anaconda, it also has a copy of SQLite - without support to readline. - Instructors will provide a workaround for it if needed.

-
diff --git a/_includes/install_instructions/videoconferencing.html b/_includes/install_instructions/videoconferencing.html deleted file mode 100644 index f3ab050..0000000 --- a/_includes/install_instructions/videoconferencing.html +++ /dev/null @@ -1,44 +0,0 @@ - -

Install the videoconferencing client

- -{% comment %} -Replace the paragraph below with the relevant installation instructions -if you do not use Zoom -{% endcomment %} -

- If you haven't used Zoom before, go to the - official website - to download and install the Zoom client for your computer. -

- - -

Set up your workspace

- -

- Like other Carpentries workshops, - you will be learning by "coding along" with the Instructors. - To do this, you will need to have both the window for the tool - you will be learning about (a terminal, RStudio, your web browser, etc..) - and the window for the Zoom video conference client open. - In order to see both at once, - we recommend using one of the following set up options: -

    -
  • Two monitors: If you have two monitors, - plan to have the tool you are learning up on one monitor and - the video conferencing software on the other.
  • -
  • Two devices: If you don't have two monitors, - do you have another device (tablet, smartphone) with a medium to large - sized screen? If so, try using the smaller device as your video - conference connection and your larger device (laptop or desktop) - to follow along with the tool you will be learning about.
  • -
  • Divide your screen: If you only have one device - and one screen, practice having two windows - (the video conference program and one of the tools you will be using - at the workshop) open together. - How can you best fit both on your screen? - Will it work better for you to toggle between them - using a keyboard shortcut? - Try it out in advance to decide what will work best for you.
  • -
- This blog post includes detailed information on how to set up your screen to follow along during the workshop. -

diff --git a/_includes/lc/intro.html b/_includes/lc/intro.html deleted file mode 100644 index b218f2b..0000000 --- a/_includes/lc/intro.html +++ /dev/null @@ -1,19 +0,0 @@ -

- Library Carpentry - is made by people working in library- and information-related roles to help you: -

-
    -
  • automate repetitive, boring, error-prone tasks
  • -
  • create, maintain and analyze sustainable and reusable data
  • -
  • work effectively with IT and systems colleagues
  • -
  • better understand the use of software in research
  • -
  • and much more...
  • -
-

- - Library Carpentry introduces you to the fundamentals of computing - and provides you with a platform for further self-directed learning. - For more information on what we teach and why, please see our paper - "Library Carpentry: software skills training for library professionals". - -

diff --git a/_includes/lc/schedule.html b/_includes/lc/schedule.html deleted file mode 100644 index 70df6e6..0000000 --- a/_includes/lc/schedule.html +++ /dev/null @@ -1,27 +0,0 @@ -
-
-

Day 1

- - - - - - - - - -
Before Starting Pre-workshop survey
09:00 Jargon Busting, A Computational Approach, Introduction to Working with Data (Regular Expressions)
10:30 Morning break
12:00 Lunch break
13:00 The Unix Shell
14:30 Afternoon break
16:00 Wrap-up
16:30 END
-
-
-

Day 2

- - - - - - - - -
09:00 Introduction to Git
10:30 Morning break
12:00 Lunch break
13:00 OpenRefine
14:30 Afternoon break
16:00 Wrap-up
16:30 Post-workshop survey
-
-
diff --git a/_includes/lc/setup.html b/_includes/lc/setup.html deleted file mode 100644 index e97cdbb..0000000 --- a/_includes/lc/setup.html +++ /dev/null @@ -1,45 +0,0 @@ -
{% comment %} Start of 'shell' section. {% endcomment %} -

The Bash Shell

-

- Bash is a commonly-used shell that gives you the power to do simple tasks - more quickly. Please find setup instructions in - the lesson. -

-
- -
-

OpenRefine

-

- OpenRefine is a tool to clean up and organize messy data. Please find instructions to - install it and the data used in the lesson in the - lesson. -

-
- -
{% comment %} Start of 'Git' section. GitHub browser compatibility - is given at https://help.github.com/articles/supported-browsers/{% endcomment %} -

Git

-

- Git is a version control system that lets you track who made changes - to what when and has options for easily updating a shared or public - version of your code - on https://github.com. -

-

- Follow the instructions on - the lesson to - install Git on your system. -

-

- You will need an account at github.com - for parts of the Git lesson. Basic GitHub accounts are free. We encourage - you to create a GitHub account if you don't have one already. - Please consider what personal information you'd like to reveal. For - example, you may want to review these - instructions - for keeping your email address private provided at GitHub. You will - need a - supported - web browser. -

-
diff --git a/_includes/lc/who.html b/_includes/lc/who.html deleted file mode 100644 index ecbf706..0000000 --- a/_includes/lc/who.html +++ /dev/null @@ -1,8 +0,0 @@ -

- Who: - The course is for people working in library- and information-related roles. - - You don't need to have any previous knowledge of the tools that - will be presented at the workshop. - -

diff --git a/_includes/swc/intro.html b/_includes/swc/intro.html deleted file mode 100644 index 522dee1..0000000 --- a/_includes/swc/intro.html +++ /dev/null @@ -1,18 +0,0 @@ -

- Software Carpentry - aims to help researchers get their work done - in less time and with less pain - by teaching them basic research computing skills. - This hands-on workshop will cover basic concepts and tools, - including program design, version control, data management, - and task automation. - Participants will be encouraged to help one another - and to apply what they have learned to their own research problems. -

-

- - For more information on what we teach and why, - please see our paper - "Best Practices for Scientific Computing". - -

diff --git a/_includes/swc/schedule.html b/_includes/swc/schedule.html deleted file mode 100644 index 0696ea6..0000000 --- a/_includes/swc/schedule.html +++ /dev/null @@ -1,40 +0,0 @@ -
-
-

Day 1

- - - - - - - {% if site.flavor == "r" %} - - - - {% elsif site.flavor == "python" %} - - - - {% else %} - {% include warning-flavor.html %} - {% endif %} - - -
Before Pre-workshop survey
09:00 Automating Tasks with the Unix Shell
10:30 Morning break
11:00 Automating Tasks with the Unix Shell (Continued)
12:00 Lunch break
13:00 Building Programs with R
14:30 Afternoon break
15:00 Building Programs with R (Continued)
13:00 Building Programs with Python
14:30 Afternoon break
15:00 Building Programs with Python (Continued)
16:00 Wrap-up
16:30 END
-
-
-

Day 2

- - - - - - - - - - - -
09:00 Version Control with Git
10:30 Morning break
11:00 Version Control with Git (Continued)
12:00 Lunch break
13:00 Managing Data with SQL
14:30 Afternoon break
15:00 Managing Data with SQL (Continued)
16:00 Wrap-up
16:30 Post-workshop Survey
16:40 END
-
-
diff --git a/_includes/swc/setup.html b/_includes/swc/setup.html deleted file mode 100644 index f6eefa3..0000000 --- a/_includes/swc/setup.html +++ /dev/null @@ -1,28 +0,0 @@ -{% assign curricula = "swc-gapminder|swc-inflammation" | split: "|" %} -{% unless curricula contains site.curriculum %} -{% include warning-curriculum.html %} -{% endunless %} - -{% include install_instructions/shell.html %} -{% include install_instructions/git.html %} -{% include install_instructions/editor.html %} - -{% if site.flavor == "r" %} -{% include install_instructions/r.html %} -{% elsif site.flavor == "python" %} -{% include install_instructions/python.html %} -{% elsif site.flavor == "FIXME" %} -{% include install_instructions/r.html %} -{% include install_instructions/python.html %} -{% else %} -{% include warning-flavor.html %} -{% endif %} - -{% comment %} -The following setup instructions are commented out because Carpentries workshops -cover the these topics less frequently. Please uncomment the lines that -correspond to the topics covered in your workshop. - -{% include install_instructions/sql.html %} -{% include install_instructions/openrefine.html %} -{% endcomment %} diff --git a/_includes/swc/who.html b/_includes/swc/who.html deleted file mode 100644 index 2d8e94a..0000000 --- a/_includes/swc/who.html +++ /dev/null @@ -1,8 +0,0 @@ -

- Who: - The course is aimed at graduate students and other researchers. - - You don't need to have any previous knowledge of the tools - that will be presented at the workshop. - -

diff --git a/setup/swc-installation-test-1.py b/setup/swc-installation-test-1.py deleted file mode 100755 index d6d8946..0000000 --- a/setup/swc-installation-test-1.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -"""Test script to check required Python version. - -Execute this code at the command line by typing: - - python swc-installation-test-1.py - -How to get a command line: - -- On OSX run this with the Terminal application. - -- On Windows, go to the Start menu, select 'Run' and type 'cmd' -(without the quotes) to run the 'cmd.exe' Windows Command Prompt. - -- On Linux, either use your login shell directly, or run one of a - number of graphical terminals (e.g. 'xterm', 'gnome-terminal', ...). - -For some screen shots, see: - - http://software-carpentry.org/setup/terminal.html - -Run the script and follow the instructions it prints at the end. If -you see an error saying that the 'python' command was not found, than -you may not have any version of Python installed. See: - - http://www.python.org/download/releases/2.7.3/#download - -for installation instructions. - -This test is separate to avoid Python syntax errors parsing the more -elaborate `swc-installation-test-2.py`. -""" - -import sys as _sys - - -__version__ = '0.2' - - -def check(): - if _sys.version_info < (3, 3): - print('check for Python version (python):') - print('outdated version of Python: ' + _sys.version) - return False - return True - - -if __name__ == '__main__': - if check(): - print('Passed') - print('version of Python: ' + _sys.version) - else: - print('Failed') - print('Install a current version of Python 3!') - print('http://continuum.io/downloads') - _sys.exit(1) diff --git a/setup/swc-installation-test-2.py b/setup/swc-installation-test-2.py deleted file mode 100755 index 29d1ed7..0000000 --- a/setup/swc-installation-test-2.py +++ /dev/null @@ -1,1044 +0,0 @@ -#!/usr/bin/env python - -"""Test script to check for required functionality. - -Execute this code at the command line by typing: - - python swc-installation-test-2.py - -Run the script and follow the instructions it prints at the end. - -This script requires at least Python 2.6. You can check the version -of Python that you have installed with 'swc-installation-test-1.py'. - -By default, this script will test for all the dependencies your -instructor thinks you need. If you want to test for a different set -of packages, you can list them on the command line. For example: - - python swc-installation-test-2.py git virtual-editor - -This is useful if the original test told you to install a more recent -version of a particular dependency, and you just want to re-test that -dependency. -""" - -# Some details about the implementation: - -# The dependencies are divided into a hierarchy of classes rooted on -# Dependency class. You can refer to the code to see which package -# comes under which type of dependency. - -# The CHECKER dictionary stores information about all the dependencies -# and CHECKS stores list of the dependencies which are to be checked in -# the current workshop. - -# In the "__name__ == '__main__'" block, we launch all the checks with -# check() function, which prints information about the tests as they run -# and details about the failures after the tests complete. In case of -# failure, the functions print_system_info() and print_suggestions() -# are called after this, where the former prints information about the -# user's system for debugging purposes while the latter prints some -# suggestions to follow. - - -from __future__ import print_function # for Python 2.6 compatibility - -import distutils.ccompiler as _distutils_ccompiler -import fnmatch as _fnmatch -try: # Python 2.7 and 3.x - import importlib as _importlib -except ImportError: # Python 2.6 and earlier - class _Importlib (object): - """Minimal workarounds for functions we need - """ - @staticmethod - def import_module(name): - module = __import__(name) - for n in name.split('.')[1:]: - module = getattr(module, n) - return module - _importlib = _Importlib() -import logging as _logging -import os as _os -import platform as _platform -import re as _re -import shlex as _shlex -import subprocess as _subprocess -import sys as _sys -try: # Python 3.x - import urllib.parse as _urllib_parse -except ImportError: # Python 2.x - import urllib as _urllib_parse # for quote() -import xml.etree.ElementTree as _element_tree - - -if not hasattr(_shlex, 'quote'): # Python versions older than 3.3 - # Use the undocumented pipes.quote() - import pipes as _pipes - _shlex.quote = _pipes.quote - - -__version__ = '0.1' - -# Comment out any entries you don't need -CHECKS = [ -# Shell - 'virtual-shell', -# Editors - 'virtual-editor', -# Browsers - 'virtual-browser', -# Version control - 'git', - 'hg', # Command line tool - #'mercurial', # Python package - 'EasyMercurial', -# Build tools and packaging - 'make', - 'virtual-pypi-installer', - 'setuptools', - #'xcode', -# Testing - 'nosetests', # Command line tool - 'nose', # Python package - 'py.test', # Command line tool - 'pytest', # Python package -# SQL - 'sqlite3', # Command line tool - 'sqlite3-python', # Python package -# Python - 'python', - 'ipython', # Command line tool - 'jupyter', # Former IPython features, notebook, etc. - 'argparse', # Useful for utility scripts - 'numpy', - 'scipy', - 'matplotlib', - 'pandas', - #'sympy', - #'Cython', - #'networkx', - #'mayavi.mlab', - ] - -CHECKER = {} - -_ROOT_PATH = _os.sep -if _platform.system() == 'win32': - _ROOT_PATH = 'c:\\' - - -class InvalidCheck (KeyError): - def __init__(self, check): - super(InvalidCheck, self).__init__(check) - self.check = check - - def __str__(self): - return self.check - - -class DependencyError (Exception): - _default_url = 'http://software-carpentry.org/setup/' - _setup_urls = { # (system, version, package) glob pairs - ('*', '*', 'Cython'): 'http://docs.cython.org/src/quickstart/install.html', - ('Linux', '*', 'EasyMercurial'): 'http://easyhg.org/download.html#download-linux', - ('Darwin', '*', 'EasyMercurial'): 'http://easyhg.org/download.html#download-mac', - ('Windows', '*', 'EasyMercurial'): 'http://easyhg.org/download.html#download-windows', - ('*', '*', 'EasyMercurial'): 'http://easyhg.org/download.html', - ('*', '*', 'argparse'): 'https://pypi.python.org/pypi/argparse#installation', - ('*', '*', 'ash'): 'http://www.in-ulm.de/~mascheck/various/ash/', - ('*', '*', 'bash'): 'http://www.gnu.org/software/bash/manual/html_node/Basic-Installation.html#Basic-Installation', - ('Linux', '*', 'chromium'): 'http://code.google.com/p/chromium/wiki/LinuxBuildInstructions', - ('Darwin', '*', 'chromium'): 'http://code.google.com/p/chromium/wiki/MacBuildInstructions', - ('Windows', '*', 'chromium'): 'http://www.chromium.org/developers/how-tos/build-instructions-windows', - ('*', '*', 'chromium'): 'http://www.chromium.org/developers/how-tos', - ('Windows', '*', 'emacs'): 'http://www.gnu.org/software/emacs/windows/Installing-Emacs.html', - ('*', '*', 'emacs'): 'http://www.gnu.org/software/emacs/#Obtaining', - ('*', '*', 'firefox'): 'http://www.mozilla.org/en-US/firefox/new/', - ('Linux', '*', 'gedit'): 'http://www.linuxfromscratch.org/blfs/view/svn/gnome/gedit.html', - ('*', '*', 'git'): 'http://git-scm.com/downloads', - ('*', '*', 'google-chrome'): 'https://www.google.com/intl/en/chrome/browser/', - ('*', '*', 'hg'): 'http://mercurial.selenic.com/', - ('*', '*', 'mercurial'): 'http://mercurial.selenic.com/', - ('*', '*', 'jupyter'): 'http://jupyter.org/install.html', - ('*', '*', 'ipython'): 'http://ipython.org/install.html', - ('*', '*', 'jinja'): 'http://jinja.pocoo.org/docs/intro/#installation', - ('*', '*', 'kate'): 'http://kate-editor.org/get-it/', - ('*', '*', 'make'): 'http://www.gnu.org/software/make/', - ('Darwin', '*', 'matplotlib'): 'http://matplotlib.org/users/installing.html#building-on-osx', - ('Windows', '*', 'matplotlib'): 'http://matplotlib.org/users/installing.html#installing-on-windows', - ('*', '*', 'matplotlib'): 'http://matplotlib.org/users/installing.html#installing', - ('*', '*', 'mayavi.mlab'): 'http://docs.enthought.com/mayavi/mayavi/installation.html', - ('*', '*', 'nano'): 'http://www.nano-editor.org/dist/latest/faq.html#3', - ('*', '*', 'networkx'): 'http://networkx.github.com/documentation/latest/install.html#installing', - ('*', '*', 'nose'): 'https://nose.readthedocs.org/en/latest/#installation-and-quick-start', - ('*', '*', 'nosetests'): 'https://nose.readthedocs.org/en/latest/#installation-and-quick-start', - ('*', '*', 'notepad++'): 'http://notepad-plus-plus.org/download/v6.3.html', - ('*', '*', 'numpy'): 'http://docs.scipy.org/doc/numpy/user/install.html', - ('*', '*', 'pandas'): 'http://pandas.pydata.org/pandas-docs/stable/install.html', - ('*', '*', 'pip'): 'http://www.pip-installer.org/en/latest/installing.html', - ('*', '*', 'pytest'): 'http://pytest.org/latest/getting-started.html', - ('*', '*', 'python'): 'http://www.python.org/download/releases/2.7.3/#download', - ('*', '*', 'pyzmq'): 'https://github.com/zeromq/pyzmq/wiki/Building-and-Installing-PyZMQ', - ('*', '*', 'py.test'): 'http://pytest.org/latest/getting-started.html', - ('Linux', '*', 'scipy'): 'http://www.scipy.org/Installing_SciPy/Linux', - ('Darwin', '*', 'scipy'): 'http://www.scipy.org/Installing_SciPy/Mac_OS_X', - ('Windows', '*', 'scipy'): 'http://www.scipy.org/Installing_SciPy/Windows', - ('*', '*', 'scipy'): 'http://www.scipy.org/Installing_SciPy', - ('*', '*', 'setuptools'): 'https://pypi.python.org/pypi/setuptools#installation-instructions', - ('*', '*', 'sqlite3'): 'http://www.sqlite.org/download.html', - ('*', '*', 'sublime-text'): 'http://www.sublimetext.com/2', - ('*', '*', 'sympy'): 'http://docs.sympy.org/dev/install.html', - ('Darwin', '*', 'textmate'): 'http://macromates.com/', - ('Darwin', '*', 'bbedit'): 'http://www.barebones.com/products/bbedit/download.html', - ('*', '*', 'tornado'): 'http://www.tornadoweb.org/', - ('*', '*', 'vim'): 'http://www.vim.org/download.php', - ('Darwin', '*', 'xcode'): 'https://developer.apple.com/xcode/', - ('*', '*', 'xemacs'): 'http://www.us.xemacs.org/Install/', - ('*', '*', 'zsh'): 'http://www.zsh.org/', - } - - def _get_message(self): - return self._message - def _set_message(self, message): - self._message = message - message = property(_get_message, _set_message) - - def __init__(self, checker, message, causes=None): - super(DependencyError, self).__init__(message) - self.checker = checker - self.message = message - if causes is None: - causes = [] - self.causes = causes - - def get_url(self): - system = _platform.system() - version = None - for pversion in ( - 'linux_distribution', - 'mac_ver', - 'win32_ver', - ): - value = getattr(_platform, pversion)() - if value[0]: - version = value[0] - break - package = self.checker.name - for (s,v,p),url in self._setup_urls.items(): - if (_fnmatch.fnmatch(system, s) and - _fnmatch.fnmatch(version, v) and - _fnmatch.fnmatch(package, p)): - return url - return self._default_url - - def __str__(self): - url = self.get_url() - lines = [ - 'check for {0} failed:'.format(self.checker.full_name()), - ' ' + self.message, - ' For instructions on installing an up-to-date version, see', - ' ' + url, - ] - if self.causes: - lines.append(' causes:') - for cause in self.causes: - lines.extend(' ' + line for line in str(cause).splitlines()) - return '\n'.join(lines) - - -def check(checks=None): - successes = [] - failures = [] - if not checks: - checks = CHECKS - for check in checks: - try: - checker = CHECKER[check] - except KeyError as e: - raise InvalidCheck(check)# from e - _sys.stdout.write('check {0}...\t'.format(checker.full_name())) - try: - version = checker.check() - except DependencyError as e: - failures.append(e) - _sys.stdout.write('fail\n') - else: - _sys.stdout.write('pass\n') - successes.append((checker, version)) - if successes: - print('\nSuccesses:\n') - for checker,version in successes: - print('{0} {1}'.format( - checker.full_name(), - version or 'unknown')) - if failures: - print('\nFailures:') - printed = [] - for failure in failures: - if failure not in printed: - print() - print(failure) - printed.append(failure) - return False - return True - - -class Dependency (object): - def __init__(self, name, long_name=None, minimum_version=None, - version_delimiter='.', and_dependencies=None, - or_dependencies=None): - self.name = name - self.long_name = long_name or name - self.minimum_version = minimum_version - self.version_delimiter = version_delimiter - if not and_dependencies: - and_dependencies = [] - self.and_dependencies = and_dependencies - if not or_dependencies: - or_dependencies = [] - self.or_dependencies = or_dependencies - self._check_error = None - - def __str__(self): - return '<{0} {1}>'.format(type(self).__name__, self.name) - - def full_name(self): - if self.name == self.long_name: - return self.name - else: - return '{0} ({1})'.format(self.long_name, self.name) - - def check(self): - if self._check_error: - raise self._check_error - try: - self._check_dependencies() - return self._check() - except DependencyError as e: - self._check_error = e # cache for future calls - raise - - def _check_dependencies(self): - for dependency in self.and_dependencies: - if not hasattr(dependency, 'check'): - dependency = CHECKER[dependency] - try: - dependency.check() - except DependencyError as e: - raise DependencyError( - checker=self, - message=( - 'some dependencies for {0} were not satisfied' - ).format(self.full_name()), - causes=[e]) - self.or_pass = None - or_errors = [] - for dependency in self.or_dependencies: - if not hasattr(dependency, 'check'): - dependency = CHECKER[dependency] - try: - version = dependency.check() - except DependencyError as e: - or_errors.append(e) - else: - self.or_pass = { - 'dependency': dependency, - 'version': version, - } - break # no need to test other dependencies - if self.or_dependencies and not self.or_pass: - raise DependencyError( - checker=self, - message=( - '{0} requires at least one of the following dependencies' - ).format(self.full_name()), - causes=or_errors) - - def _check(self): - version = self._get_version() - parsed_version = None - if hasattr(self, '_get_parsed_version'): - parsed_version = self._get_parsed_version() - if self.minimum_version: - self._check_version(version=version, parsed_version=parsed_version) - return version - - def _get_version(self): - raise NotImplementedError(self) - - def _minimum_version_string(self): - return self.version_delimiter.join( - str(part) for part in self.minimum_version) - - def _check_version(self, version, parsed_version=None): - if not parsed_version: - parsed_version = self._parse_version(version=version) - if not parsed_version or parsed_version < self.minimum_version: - raise DependencyError( - checker=self, - message='outdated version of {0}: {1} (need >= {2})'.format( - self.full_name(), version, self._minimum_version_string())) - - def _parse_version(self, version): - if not version: - return None - parsed_version = [] - for part in version.split(self.version_delimiter): - try: - parsed_version.append(int(part)) - except ValueError as e: - raise DependencyError( - checker=self, - message=( - 'unparsable {0!r} in version {1} of {2}, (need >= {3})' - ).format( - part, version, self.full_name(), - self._minimum_version_string()))# from e - return tuple(parsed_version) - - -class VirtualDependency (Dependency): - def _check(self): - return '{0} {1}'.format( - self.or_pass['dependency'].full_name(), - self.or_pass['version']) - - -class CommandDependency (Dependency): - exe_extension = _distutils_ccompiler.new_compiler().exe_extension - - def __init__(self, command, paths=None, version_options=('--version',), - stdin=None, version_regexp=None, version_stream='stdout', - **kwargs): - if 'name' not in kwargs: - kwargs['name'] = command - super(CommandDependency, self).__init__(**kwargs) - self.command = command - self.paths = paths - self.version_options = version_options - self.stdin = None - if not version_regexp: - regexp = r'([\d][\d{0}]*[\d])'.format(self.version_delimiter) - version_regexp = _re.compile(regexp) - self.version_regexp = version_regexp - self.version_stream = version_stream - - def _get_command_version_stream(self, command=None, stdin=None, - expect=(0,)): - if command is None: - command = self.command + (self.exe_extension or '') - if not stdin: - stdin = self.stdin - if stdin: - popen_stdin = _subprocess.PIPE - else: - popen_stdin = None - try: - p = _subprocess.Popen( - [command] + list(self.version_options), stdin=popen_stdin, - stdout=_subprocess.PIPE, stderr=_subprocess.PIPE, - universal_newlines=True) - except OSError as e: - raise DependencyError( - checker=self, - message="could not find '{0}' executable".format(command), - )# from e - stdout,stderr = p.communicate(stdin) - status = p.wait() - if status not in expect: - lines = [ - "failed to execute: {0} {1}".format( - command, - ' '.join(_shlex.quote(arg) - for arg in self.version_options)), - 'status: {0}'.format(status), - ] - for name,string in [('stdout', stdout), ('stderr', stderr)]: - if string: - lines.extend([name + ':', string]) - raise DependencyError(checker=self, message='\n'.join(lines)) - for name,string in [('stdout', stdout), ('stderr', stderr)]: - if name == self.version_stream: - if not string: - raise DependencyError( - checker=self, - message='empty version stream on {0} for {1}'.format( - self.version_stream, command)) - return string - raise NotImplementedError(self.version_stream) - - def _get_version_stream(self, **kwargs): - paths = [self.command + (self.exe_extension or '')] - if self.exe_extension: - paths.append(self.command) # also look at the extension-less path - if self.paths: - paths.extend(self.paths) - or_errors = [] - for path in paths: - try: - return self._get_command_version_stream(command=path, **kwargs) - except DependencyError as e: - or_errors.append(e) - raise DependencyError( - checker=self, - message='errors finding {0} version'.format( - self.full_name()), - causes=or_errors) - - def _get_version(self): - version_stream = self._get_version_stream() - match = self.version_regexp.search(version_stream) - if not match: - raise DependencyError( - checker=self, - message='no version string in output:\n{0}'.format( - version_stream)) - return match.group(1) - - -class VersionPlistCommandDependency (CommandDependency): - """A command that doesn't support --version or equivalent options - - On OS X, a command's executable may be hard to find, or not exist - in the PATH. Work around that by looking up the version - information in the package's version.plist file. - """ - def __init__(self, key='CFBundleShortVersionString', **kwargs): - super(VersionPlistCommandDependency, self).__init__(**kwargs) - self.key = key - - def _get_command_version_stream(self, *args, **kwargs): - raise NotImplementedError() - - def _get_version_stream(self, *args, **kwargs): - raise NotImplementedError() - - @staticmethod - def _get_parent(root, element): - """Returns the parent of this element or None for the root element - """ - for node in root.iter(): - if element in node: - return node - raise ValueError((root, element)) - - @classmethod - def _get_next(cls, root, element): - """Returns the following sibling of this element or None - """ - parent = cls._get_parent(root=root, element=element) - siblings = iter(parent) - for node in siblings: - if node == element: - try: - return next(siblings) - except StopIteration: - return None - return None - - def _get_version_from_plist(self, path): - """Parse the plist and return the value string for self.key - """ - tree = _element_tree.parse(source=path) - data = {} - for key in tree.findall('.//key'): - value = self._get_next(root=tree, element=key) - if value.tag != 'string': - raise ValueError((tree, key, value)) - data[key.text] = value.text - return data[self.key] - - def _get_version(self): - for path in self.paths: - if _os.path.exists(path): - return self._get_version_from_plist(path=path) - raise DependencyError( - checker=self, - message=( - 'nothing exists at any of the expected paths for {0}:\n {1}' - ).format( - self.full_name(), - '\n '.join(p for p in self.paths))) - - -class UserTaskDependency (Dependency): - "Prompt the user to complete a task and check for success" - def __init__(self, prompt, **kwargs): - super(UserTaskDependency, self).__init__(**kwargs) - self.prompt = prompt - - def _check(self): - if _sys.version_info >= (3, ): - result = input(self.prompt) - else: # Python 2.x - result = raw_input(self.prompt) - return self._check_result(result) - - def _check_result(self, result): - raise NotImplementedError() - - -class EditorTaskDependency (UserTaskDependency): - def __init__(self, **kwargs): - self.path = _os.path.expanduser(_os.path.join( - '~', 'swc-installation-test.txt')) - self.contents = 'Hello, world!' - super(EditorTaskDependency, self).__init__( - prompt=( - 'Open your favorite text editor and create the file\n' - ' {0}\n' - 'containing the line:\n' - ' {1}\n' - 'Press enter here after you have done this.\n' - 'You may remove the file after you have finished testing.' - ).format(self.path, self.contents), - **kwargs) - - def _check_result(self, result): - message = None - try: - with open(self.path, 'r') as f: - contents = f.read() - except IOError as e: - raise DependencyError( - checker=self, - message='could not open {0!r}: {1}'.format(self.path, e) - )# from e - if contents.strip() != self.contents: - raise DependencyError( - checker=self, - message=( - 'file contents ({0!r}) did not match the expected {1!r}' - ).format(contents, self.contents)) - - -class MakeDependency (CommandDependency): - makefile = '\n'.join([ - 'all:', - '\t@echo "MAKE_VERSION=$(MAKE_VERSION)"', - '\t@echo "MAKE=$(MAKE)"', - '', - ]) - - def _get_version(self): - try: - return super(MakeDependency, self)._get_version() - except DependencyError as e: - version_options = self.version_options - self.version_options = ['-f', '-'] - try: - stream = self._get_version_stream(stdin=self.makefile) - info = {} - for line in stream.splitlines(): - try: - key,value = line.split('=', 1) - except ValueError as ve: - raise e# from NotImplementedError(stream) - info[key] = value - if info.get('MAKE_VERSION', None): - return info['MAKE_VERSION'] - elif info.get('MAKE', None): - return None - raise e - finally: - self.version_options = version_options - - -class EasyInstallDependency (CommandDependency): - def _get_version(self): - try: - return super(EasyInstallDependency, self)._get_version() - except DependencyError as e: - version_stream = self.version_stream - try: - self.version_stream = 'stderr' - stream = self._get_version_stream(expect=(1,)) - if 'option --version not recognized' in stream: - return 'unknown (possibly Setuptools?)' - finally: - self.version_stream = version_stream - - -class PythonDependency (Dependency): - def __init__(self, name='python', long_name='Python version', - minimum_version=(2, 6), **kwargs): - super(PythonDependency, self).__init__( - name=name, long_name=long_name, minimum_version=minimum_version, - **kwargs) - - def _get_version(self): - return _sys.version - - def _get_parsed_version(self): - return _sys.version_info - - -class PythonPackageDependency (Dependency): - def __init__(self, package, **kwargs): - if 'name' not in kwargs: - kwargs['name'] = package - if 'and_dependencies' not in kwargs: - kwargs['and_dependencies'] = [] - if 'python' not in kwargs['and_dependencies']: - kwargs['and_dependencies'].append('python') - super(PythonPackageDependency, self).__init__(**kwargs) - self.package = package - - def _get_version(self): - package = self._get_package(self.package) - return self._get_version_from_package(package) - - def _get_package(self, package): - try: - return _importlib.import_module(package) - except ImportError as e: - raise DependencyError( - checker=self, - message="could not import the '{0}' package for {1}".format( - package, self.full_name()), - )# from e - - def _get_version_from_package(self, package): - try: - version = package.__version__ - except AttributeError: - version = None - return version - - -class MercurialPythonPackage (PythonPackageDependency): - def _get_version(self): - try: # mercurial >= 1.2 - package = _importlib.import_module('mercurial.util') - except ImportError as e: # mercurial <= 1.1.2 - package = self._get_package('mercurial.version') - return package.get_version() - else: - return package.version() - - -class TornadoPythonPackage (PythonPackageDependency): - def _get_version_from_package(self, package): - return package.version - - def _get_parsed_version(self): - package = self._get_package(self.package) - return package.version_info - - -class SQLitePythonPackage (PythonPackageDependency): - def _get_version_from_package(self, package): - return _sys.version - - def _get_parsed_version(self): - return _sys.version_info - - -def _program_files_paths(*args): - "Utility for generating MS Windows search paths" - pf = _os.environ.get('ProgramFiles', '/usr/bin') - pfx86 = _os.environ.get('ProgramFiles(x86)', pf) - paths = [_os.path.join(pf, *args)] - if pfx86 != pf: - paths.append(_os.path.join(pfx86, *args)) - return paths - - -CHECKER['python'] = PythonDependency() - - -for command,long_name,minimum_version,paths in [ - ('sh', 'Bourne Shell', None, None), - ('ash', 'Almquist Shell', None, None), - ('bash', 'Bourne Again Shell', None, None), - ('csh', 'C Shell', None, None), - ('ksh', 'KornShell', None, None), - ('dash', 'Debian Almquist Shell', None, None), - ('tcsh', 'TENEX C Shell', None, None), - ('zsh', 'Z Shell', None, None), - ('git', 'Git', (1, 7, 0), None), - ('hg', 'Mercurial', (2, 0, 0), None), - ('EasyMercurial', None, (1, 3), None), - ('pip', None, None, None), - ('sqlite3', 'SQLite 3', None, None), - ('nosetests', 'Nose', (1, 0, 0), None), - ('ipython', 'IPython script', (1, 0), None), - ('emacs', 'Emacs', None, None), - ('xemacs', 'XEmacs', None, None), - ('vim', 'Vim', None, None), - ('vi', None, None, None), - ('nano', 'Nano', None, None), - ('gedit', None, None, None), - ('kate', 'Kate', None, None), - ('notepad++', 'Notepad++', None, - _program_files_paths('Notepad++', 'notepad++.exe')), - ('firefox', 'Firefox', None, - _program_files_paths('Mozilla Firefox', 'firefox.exe')), - ('google-chrome', 'Google Chrome', None, - _program_files_paths('Google', 'Chrome', 'Application', 'chrome.exe') - ), - ('chromium', 'Chromium', None, None), - ]: - if not long_name: - long_name = command - CHECKER[command] = CommandDependency( - command=command, paths=paths, long_name=long_name, - minimum_version=minimum_version) -del command, long_name, minimum_version, paths # cleanup namespace - - -CHECKER['make'] = MakeDependency(command='make', minimum_version=None) - - -CHECKER['easy_install'] = EasyInstallDependency( - command='easy_install', long_name='Setuptools easy_install', - minimum_version=None) - - -CHECKER['py.test'] = CommandDependency( - command='py.test', version_stream='stderr', - minimum_version=None) - - -for paths,name,long_name in [ - ([_os.path.join(_ROOT_PATH, 'Applications', 'Sublime Text 2.app', - 'Contents', 'version.plist')], - 'sublime-text', 'Sublime Text'), - ([_os.path.join(_ROOT_PATH, 'Applications', 'TextMate.app', - 'Contents', 'version.plist')], - 'textmate', 'TextMate'), - ([_os.path.join(_ROOT_PATH, 'Applications', 'BBEdit.app', - 'Contents', 'version.plist')], - 'bbedit', 'BBEdit'), - ([_os.path.join(_ROOT_PATH, 'Applications', 'Safari.app', - 'Contents', 'version.plist')], - 'safari', 'Safari'), - ([_os.path.join(_ROOT_PATH, 'Applications', 'Xcode.app', - 'Contents', 'version.plist'), # OS X >=1.7 - _os.path.join(_ROOT_PATH, 'Developer', 'Applications', 'Xcode.app', - 'Contents', 'version.plist'), # OS X 1.6, - ], - 'xcode', 'Xcode'), - ]: - if not long_name: - long_name = name - CHECKER[name] = VersionPlistCommandDependency( - command=None, paths=paths, name=name, long_name=long_name) -del paths, name, long_name # cleanup namespace - - -for package,name,long_name,minimum_version,and_dependencies in [ - ('nose', None, 'Nose Python package', - CHECKER['nosetests'].minimum_version, None), - ('pytest', None, 'pytest Python package', - CHECKER['py.test'].minimum_version, None), - ('jinja2', 'jinja', 'Jinja', (2, 6), None), - ('zmq', 'pyzmq', 'PyZMQ', (2, 1, 4), None), - ('jupyter', None, 'Jupyter', - # FIXME should use minimum version for Jupyter - # CHECKER['ipython'].minimum_version, [ - None, [ - 'jinja', - 'tornado', - 'pyzmq', - VirtualDependency( - name='virtual-browser-ipython', - long_name='Jupyter-compatible web browser', - or_dependencies=[ - CommandDependency( - command=CHECKER['firefox'].command, - paths=CHECKER['firefox'].paths, - name='{0}-for-ipython'.format( - CHECKER['firefox'].name), - long_name='{0} for IPython'.format( - CHECKER['firefox'].long_name), - minimum_version=(6, 0)), - CommandDependency( - command=CHECKER['google-chrome'].command, - paths=CHECKER['google-chrome'].paths, - name='{0}-for-ipython'.format( - CHECKER['google-chrome'].name), - long_name='{0} for IPython'.format( - CHECKER['google-chrome'].long_name), - minimum_version=(13, 0)), - CommandDependency( - command=CHECKER['chromium'].command, - paths=CHECKER['chromium'].paths, - name='{0}-for-ipython'.format( - CHECKER['chromium'].name), - long_name='{0} for IPython'.format( - CHECKER['chromium'].long_name), - minimum_version=(13, 0)), - VersionPlistCommandDependency( - command=CHECKER['safari'].command, - paths=CHECKER['safari'].paths, - key=CHECKER['safari'].key, - name='{0}-for-ipython'.format( - CHECKER['safari'].name), - long_name='{0} for IPython'.format( - CHECKER['safari'].long_name), - minimum_version=(5, 0)), - ]), - ]), - ('argparse', None, 'Argparse', None, None), - ('numpy', None, 'NumPy', None, None), - ('scipy', None, 'SciPy', None, None), - ('matplotlib', None, 'Matplotlib', None, None), - ('pandas', None, 'Pandas', (0, 8), None), - ('sympy', None, 'SymPy', None, None), - ('Cython', None, None, None, None), - ('networkx', None, 'NetworkX', None, None), - ('mayavi.mlab', None, 'MayaVi', None, None), - ('setuptools', None, 'Setuptools', None, None), - ]: - if not name: - name = package - if not long_name: - long_name = name - kwargs = {} - if and_dependencies: - kwargs['and_dependencies'] = and_dependencies - CHECKER[name] = PythonPackageDependency( - package=package, name=name, long_name=long_name, - minimum_version=minimum_version, **kwargs) -# cleanup namespace -del package, name, long_name, minimum_version, and_dependencies, kwargs - - -CHECKER['mercurial'] = MercurialPythonPackage( - package='mercurial.util', name='mercurial', - long_name='Mercurial Python package', - minimum_version=CHECKER['hg'].minimum_version) - - -CHECKER['tornado'] = TornadoPythonPackage( - package='tornado', name='tornado', long_name='Tornado', minimum_version=(2, 0)) - - -CHECKER['sqlite3-python'] = SQLitePythonPackage( - package='sqlite3', name='sqlite3-python', - long_name='SQLite Python package', - minimum_version=CHECKER['sqlite3'].minimum_version) - - -CHECKER['other-editor'] = EditorTaskDependency( - name='other-editor', long_name='') - - -for name,long_name,dependencies in [ - ('virtual-shell', 'command line shell', ( - 'bash', - 'dash', - 'ash', - 'zsh', - 'ksh', - 'csh', - 'tcsh', - 'sh', - )), - ('virtual-editor', 'text/code editor', ( - 'emacs', - 'xemacs', - 'vim', - 'vi', - 'nano', - 'gedit', - 'kate', - 'notepad++', - 'sublime-text', - 'textmate', - 'bbedit', - 'other-editor', # last because it requires user interaction - )), - ('virtual-browser', 'web browser', ( - 'firefox', - 'google-chrome', - 'chromium', - 'safari', - )), - ('virtual-pypi-installer', 'PyPI installer', ( - 'pip', - 'easy_install', - )), - ]: - CHECKER[name] = VirtualDependency( - name=name, long_name=long_name, or_dependencies=dependencies) -del name, long_name, dependencies # cleanup namespace - - -def _print_info(key, value, indent=19): - print('{0}{1}: {2}'.format(key, ' '*(indent-len(key)), value)) - -def print_system_info(): - print("If you do not understand why the above failures occurred,") - print("copy and send the *entire* output (all info above and summary") - print("below) to the instructor for help.") - print() - print('==================') - print('System information') - print('==================') - _print_info('os.name', _os.name) - _print_info('os.uname', _platform.uname()) - _print_info('platform', _sys.platform) - _print_info('platform+', _platform.platform()) - for pversion in ( - 'linux_distribution', - 'mac_ver', - 'win32_ver', - ): - value = getattr(_platform, pversion)() - if value[0]: - _print_info(pversion, value) - _print_info('prefix', _sys.prefix) - _print_info('exec_prefix', _sys.exec_prefix) - _print_info('executable', _sys.executable) - _print_info('version_info', _sys.version_info) - _print_info('version', _sys.version) - _print_info('environment', '') - for key,value in sorted(_os.environ.items()): - print(' {0}={1}'.format(key, value)) - print('==================') - -def print_suggestions(instructor_fallback=True): - print() - print('For suggestions on installing missing packages, see') - print('http://software-carpentry.org/setup/') - print('') - print('For instructings on installing a particular package,') - print('see the failure message for that package printed above.') - if instructor_fallback: - print('') - print('For help, email the *entire* output of this script to') - print('your instructor.') - - -if __name__ == '__main__': - import optparse as _optparse - - parser = _optparse.OptionParser(usage='%prog [options] [check...]') - epilog = __doc__ - parser.format_epilog = lambda formatter: '\n' + epilog - parser.add_option( - '-v', '--verbose', action='store_true', - help=('print additional information to help troubleshoot ' - 'installation issues')) - options,args = parser.parse_args() - try: - passed = check(args) - except InvalidCheck as e: - print("I don't know how to check for {0!r}".format(e.check)) - print('I do know how to check for:') - for key,checker in sorted(CHECKER.items()): - if checker.long_name != checker.name: - print(' {0} {1}({2})'.format( - key, ' '*(20-len(key)), checker.long_name)) - else: - print(' {0}'.format(key)) - _sys.exit(1) - if not passed: - if options.verbose: - print() - print_system_info() - print_suggestions(instructor_fallback=True) - _sys.exit(1)